< Summary

Information
Class: Allyaria.Theming.StyleTypes.StyleBorderOutlineStyle
Assembly: Allyaria.Theming
File(s): /home/runner/work/allyaria/allyaria/src/Allyaria.Theming/StyleTypes/StyleBorderOutlineStyle.cs
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 110
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Parse(...)100%22100%
TryParse(...)100%11100%
op_Implicit(...)100%11100%
op_Implicit(...)100%22100%

File(s)

/home/runner/work/allyaria/allyaria/src/Allyaria.Theming/StyleTypes/StyleBorderOutlineStyle.cs

#LineLine coverage
 1namespace Allyaria.Theming.StyleTypes;
 2
 3/// <summary>
 4/// Represents a CSS <c>border-style</c> or <c>outline-style</c> value used within the Allyaria theming system. Provides
 5/// strongly typed wrapper around standard CSS line style keywords (e.g., solid, dashed, dotted).
 6/// </summary>
 7public sealed record StyleBorderOutlineStyle : StyleValueBase
 8{
 9    /// <summary>
 10    /// Initializes a new instance of the <see cref="StyleBorderOutlineStyle" /> record using the specified border or ou
 11    /// style kind.
 12    /// </summary>
 13    /// <param name="kind">The border or outline style kind to represent.</param>
 14    public StyleBorderOutlineStyle(Kind kind)
 9815        : base(value: kind.GetDescription()) { }
 16
 17    /// <summary>Defines the supported CSS <c>border-style</c> and <c>outline-style</c> values.</summary>
 18    public enum Kind
 19    {
 20        /// <summary>Specifies a dashed line style.</summary>
 21        [Description(description: "dashed")]
 22        Dashed,
 23
 24        /// <summary>Specifies a dotted line style.</summary>
 25        [Description(description: "dotted")]
 26        Dotted,
 27
 28        /// <summary>Specifies a double-line border style.</summary>
 29        [Description(description: "double")]
 30        Double,
 31
 32        /// <summary>Specifies a 3D grooved border style that appears carved into the page.</summary>
 33        [Description(description: "groove")]
 34        Groove,
 35
 36        /// <summary>Specifies an inset 3D border style that appears embedded.</summary>
 37        [Description(description: "inset")]
 38        Inset,
 39
 40        /// <summary>Specifies that no border or outline is drawn.</summary>
 41        [Description(description: "none")]
 42        None,
 43
 44        /// <summary>Specifies an outset 3D border style that appears raised.</summary>
 45        [Description(description: "outset")]
 46        Outset,
 47
 48        /// <summary>Specifies a 3D ridged border style that appears raised from the surface.</summary>
 49        [Description(description: "ridge")]
 50        Ridge,
 51
 52        /// <summary>Specifies a single solid line border or outline.</summary>
 53        [Description(description: "solid")]
 54        Solid
 55    }
 56
 57    /// <summary>
 58    /// Parses a string representation of a CSS <c>border-style</c> or <c>outline-style</c> value into a
 59    /// <see cref="StyleBorderOutlineStyle" /> instance.
 60    /// </summary>
 61    /// <param name="value">The string representation of the style value.</param>
 62    /// <returns>A new <see cref="StyleBorderOutlineStyle" /> instance representing the parsed value.</returns>
 63    /// <exception cref="AryArgumentException">
 64    /// Thrown when the provided <paramref name="value" /> does not correspond to a valid <see cref="Kind" />.
 65    /// </exception>
 66    public static StyleBorderOutlineStyle Parse(string? value)
 1667        => value.TryParseEnum<Kind>(result: out var kind)
 1668            ? new StyleBorderOutlineStyle(kind: kind)
 1669            : throw new AryArgumentException(message: $"Invalid style: {value}", argName: nameof(value));
 70
 71    /// <summary>Attempts to parse a string into a <see cref="StyleBorderOutlineStyle" /> instance.</summary>
 72    /// <param name="value">The string representation of the border or outline style to parse.</param>
 73    /// <param name="result">
 74    /// When this method returns, contains the parsed <see cref="StyleBorderOutlineStyle" /> instance or
 75    /// <see langword="null" /> if parsing failed.
 76    /// </param>
 77    /// <returns><see langword="true" /> if parsing succeeded; otherwise, <see langword="false" />.</returns>
 78    public static bool TryParse(string? value, out StyleBorderOutlineStyle? result)
 79    {
 80        try
 81        {
 382            result = Parse(value: value);
 83
 184            return true;
 85        }
 286        catch
 87        {
 288            result = null;
 89
 290            return false;
 91        }
 392    }
 93
 94    /// <summary>Implicitly converts a string into a <see cref="StyleBorderOutlineStyle" /> instance.</summary>
 95    /// <param name="value">The string representation of the border or outline style.</param>
 96    /// <returns>A <see cref="StyleBorderOutlineStyle" /> instance representing the provided value.</returns>
 97    /// <exception cref="AryArgumentException">
 98    /// Thrown when the string cannot be parsed into a valid border or outline style
 99    /// kind.
 100    /// </exception>
 2101    public static implicit operator StyleBorderOutlineStyle(string? value) => Parse(value: value);
 102
 103    /// <summary>Implicitly converts a <see cref="StyleBorderOutlineStyle" /> instance to its string value.</summary>
 104    /// <param name="value">The <see cref="StyleBorderOutlineStyle" /> instance to convert.</param>
 105    /// <returns>
 106    /// The underlying CSS border or outline style string, or an empty string if <paramref name="value" /> is
 107    /// <see langword="null" />.
 108    /// </returns>
 2109    public static implicit operator string(StyleBorderOutlineStyle? value) => (value?.Value).OrDefaultIfEmpty();
 110}