< Summary

Information
Class: MyNet.UI.Dialogs.MessageBox.MessageBoxOptions
Assembly: MyNet.UI
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.UI/Dialogs/MessageBox/MessageBoxOptions.cs
Tag: 323_28699572109
Line coverage
0%
Covered lines: 0
Uncovered lines: 8
Coverable lines: 8
Total lines: 57
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Create(...)100%210%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.UI/Dialogs/MessageBox/MessageBoxOptions.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="MessageBoxOptions.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7namespace MyNet.UI.Dialogs.MessageBox;
 8
 9/// <summary>
 10/// Options for configuring the message box dialog.
 11/// </summary>
 12public sealed class MessageBoxOptions
 13{
 14    /// <summary>
 15    /// Gets the message displayed in the message box.
 16    /// </summary>
 17    public string Message { get; internal set; } = string.Empty;
 18
 19    /// <summary>
 20    /// Gets the title of the message box.
 21    /// </summary>
 22    public string? Title { get; internal set; }
 23
 24    /// <summary>
 25    /// Gets the severity of the message (Info, Warning, Error, etc.).
 26    /// </summary>
 27    public MessageSeverity Severity { get; internal set; } = MessageSeverity.Information;
 28
 29    /// <summary>
 30    /// Gets the buttons displayed in the message box.
 31    /// </summary>
 32    public MessageBoxResultOption Buttons { get; internal set; } = MessageBoxResultOption.Ok;
 33
 34    /// <summary>
 35    /// Gets the default selected result.
 36    /// </summary>
 37    public MessageBoxResult DefaultResult { get; internal set; } = MessageBoxResult.Ok;
 38
 39    /// <summary>
 40    /// Creates a configured <see cref="MessageBoxOptions"/> instance for use with <see cref="IMessageBoxFactory"/>.
 41    /// </summary>
 42    public static MessageBoxOptions Create(
 43        string message,
 44        string? title = null,
 45        MessageSeverity severity = MessageSeverity.Information,
 46        MessageBoxResultOption buttons = MessageBoxResultOption.Ok,
 47        MessageBoxResult defaultResult = MessageBoxResult.Ok)
 048        => new()
 049        {
 050            Message = message,
 051            Title = title,
 052            Severity = severity,
 053            Buttons = buttons,
 054            DefaultResult = defaultResult
 055        };
 56}
 57