< Summary

Information
Class: DirectSight.Parser.Analysis.Branch
Assembly DirectSight
File(s): /home/runner/work/DirectSight/DirectSight/DirectSight/Parser/Analysis/Branch.cs
Line coverage
77%
Covered lines: 14
Uncovered lines: 4
Coverable lines: 18
Total lines: 67
Line coverage: 77.7%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%11100%
ToString()100%110%
Equals(...)100%44100%
GetHashCode()100%110%

File(s)

/home/runner/work/DirectSight/DirectSight/DirectSight/Parser/Analysis/Branch.cs

#LineLine coverage
 1namespace DirectSight.Parser.Analysis;
 2
 3/// <summary>
 4/// Represents a branch.
 5/// </summary>
 6public class Branch
 7{
 8    /// <summary>
 9    /// The unique identifier of the branch.
 10    /// </summary>
 11    private readonly string identifier;
 12
 13    /// <summary>
 14    /// Initializes a new instance of the <see cref="Branch" /> class.
 15    /// </summary>
 16    /// <param name="branchVisits">The number of branch visits.</param>
 17    /// <param name="identifier">The identifier.</param>
 77218    internal Branch(int branchVisits, string identifier)
 77219    {
 77220        this.BranchVisits = branchVisits;
 77221        this.identifier = identifier;
 77222    }
 23
 24    /// <summary>
 25    /// Gets the number of branch visits.
 26    /// </summary>
 319727    public int BranchVisits { get; internal set; }
 28
 29    /// <summary>
 30    /// Returns a <see cref="string" /> that represents this instance.
 31    /// </summary>
 32    /// <returns>
 33    /// A <see cref="string" /> that represents this instance.
 34    /// </returns>
 35    public override string ToString()
 036    {
 037        return this.identifier;
 038    }
 39
 40    /// <summary>
 41    /// Determines whether the specified <see cref="object"/> is equal to this instance.
 42    /// </summary>
 43    /// <param name="obj">The <see cref="object"/> to compare with this instance.</param>
 44    /// <returns>
 45    ///   <c>true</c> if the specified <see cref="object"/> is equal to this instance; otherwise, <c>false</c>.
 46    /// </returns>
 47    public override bool Equals(object obj)
 32848    {
 32849        if (obj == null || !obj.GetType().Equals(typeof(Branch)))
 250        {
 251            return false;
 52        }
 53        else
 32654        {
 32655            var branch = (Branch)obj;
 32656            return branch.identifier.Equals(this.identifier);
 57        }
 32858    }
 59
 60    /// <summary>
 61    /// Returns a hash code for this instance.
 62    /// </summary>
 63    /// <returns>
 64    /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
 65    /// </returns>
 066    public override int GetHashCode() => this.identifier.GetHashCode();
 67}