< Summary - PropertyGridHelpers Code Coverage

Information
Class: PropertyGridHelpers.Controls.ItemWrapper<T>
Assembly: PropertyGridHelpers
File(s): c:\agent\_work\9\s\Code\PropertyGridHelpers\Controls\ItemWrapper.cs
Tag: PropertyGridHelpers Build_2025.7.15.1_#485
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 77
Line coverage: 100%
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

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_DisplayText()100%11100%
get_Value()100%11100%
ToString()100%11100%

File(s)

c:\agent\_work\9\s\Code\PropertyGridHelpers\Controls\ItemWrapper.cs

#LineLine coverage
 1namespace PropertyGridHelpers.Controls
 2{
 3#if NET5_0_OR_GREATER
 4    /// <summary>
 5    /// Represents a strongly-typed wrapper for a ComboBox item,
 6    /// associating custom display text with an underlying value.
 7    /// </summary>
 8    /// <typeparam name="T">
 9    /// The type of the value associated with this ComboBox item.
 10    /// </typeparam>
 11    /// <param name="displayText">The text shown to the user.</param>
 12    /// <param name="value">The backing value represented by this item.</param>
 30413    public class ItemWrapper<T>(string displayText, T value)
 14#else
 15    /// <summary>
 16    /// Represents a strongly-typed wrapper for a ComboBox item,
 17    /// associating custom display text with an underlying value.
 18    /// </summary>
 19    /// <typeparam name="T">
 20    /// The type of the value associated with this ComboBox item.
 21    /// </typeparam>
 22    public class ItemWrapper<T>
 23#endif
 24    {
 25        /// <summary>
 26        /// Gets the text displayed in the ComboBox for this item.
 27        /// </summary>
 28        /// <value>
 29        /// The human-readable text shown to the user.
 30        /// </value>
 31        public string DisplayText
 32        {
 6033            get;
 34#if NET5_0_OR_GREATER
 30435        } = displayText;
 36#else
 37        }
 38#endif
 39
 40        /// <summary>
 41        /// Gets the value associated with this item.
 42        /// </summary>
 43        /// <value>
 44        /// The strongly-typed backing value.
 45        /// </value>
 46        public T Value
 47        {
 92848            get;
 49#if NET5_0_OR_GREATER
 30450        } = value;
 51#else
 52        }
 53#endif
 54
 55#if NET5_0_OR_GREATER
 56#else
 57        /// <summary>
 58        /// Initializes a new instance of the <see cref="ItemWrapper{T}"/> class.
 59        /// </summary>
 60        /// <param name="displayText">The text shown to the user.</param>
 61        /// <param name="value">The backing value represented by this item.</param>
 62        public ItemWrapper(string displayText, T value)
 63        {
 64            DisplayText = displayText;
 65            Value = value;
 66        }
 67#endif
 68
 69        /// <summary>
 70        /// Returns the display text for this item.
 71        /// </summary>
 72        /// <returns>
 73        /// A string containing the <see cref="DisplayText"/>.
 74        /// </returns>
 2875        public override string ToString() => DisplayText;
 76    }
 77}