< Summary - PropertyGridHelpers Code Coverage

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

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBlocks covered Blocks not covered Branch coverage Crap Score Cyclomatic complexity Line coverage
FlagCheckedListBoxItem(...)20----
.ctor(...)--100%11100%
get_IsFlag()--100%11100%
IsMemberFlag(...)90100%44100%

File(s)

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

#LineLine coverage
 1namespace PropertyGridHelpers.Controls
 2{
 3    /// <summary>
 4    /// Represents an item displayed in a checklist box for editing bitwise
 5    /// enum values (flags). This item stores both the integer flag value
 6    /// and a user-friendly caption.
 7    /// </summary>
 8    public class FlagCheckedListBoxItem : ItemWrapper<int>
 9    {
 10        /// <summary>
 11        /// Initializes a new instance of the <see cref="FlagCheckedListBoxItem"/> class
 12        /// with the specified flag value and display caption.
 13        /// </summary>
 14        /// <param name="value">The integer value representing the flag.</param>
 15        /// <param name="caption">The caption displayed to the user.</param>
 30416        public FlagCheckedListBoxItem(int value, string caption) : base(caption, value)
 29617        {
 30418        }
 19
 20        /// <summary>
 21        /// Gets a value indicating whether this item represents a
 22        /// single flag (a single bit set).
 23        /// </summary>
 24        /// <value>
 25        /// <c>true</c> if this value has exactly one bit set; otherwise, <c>false</c>.
 26        /// </value>
 27        public bool IsFlag =>
 4828            (Value & (Value - 1)) == 0;
 29
 30        /// <summary>
 31        /// Determines whether this flag item is a member of the specified composite flag value.
 32        /// </summary>
 33        /// <param name="composite">
 34        /// A <see cref="FlagCheckedListBoxItem"/> representing the composite flags to test against.
 35        /// </param>
 36        /// <returns>
 37        /// <c>true</c> if this flag is included in the composite; otherwise, <c>false</c>.
 38        /// </returns>
 39        public bool IsMemberFlag(FlagCheckedListBoxItem composite) =>
 4440            composite != null && IsFlag && ((Value & composite.Value) == Value);
 41    }
 42}