< Summary

Information
Class: DirectSight.Parser.Analysis.TestMethod
Assembly DirectSight
File(s): /home/runner/work/DirectSight/DirectSight/DirectSight/Parser/Analysis/TestMethod.cs
Line coverage
76%
Covered lines: 16
Uncovered lines: 5
Coverable lines: 21
Total lines: 90
Line coverage: 76.1%
Branch coverage
50%
Covered branches: 4
Total branches: 8
Branch coverage: 50%
Method coverage

Metrics

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

File(s)

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

#LineLine coverage
 1using System;
 2using System.Threading;
 3
 4namespace DirectSight.Parser.Analysis;
 5
 6/// <summary>
 7/// Name of a test method.
 8/// </summary>
 9public class TestMethod
 10{
 11    /// <summary>
 12    /// Counter for unique ids.
 13    /// </summary>
 14    private static long counter = 0;
 15
 16    /// <summary>
 17    /// Initializes a new instance of the <see cref="TestMethod" /> class.
 18    /// </summary>
 19    /// <param name="name">The name.</param>
 20    /// <param name="shortName">The short name.</param>
 45521    internal TestMethod(string name, string shortName)
 45522    {
 45523        this.Name = name ?? throw new ArgumentNullException(nameof(name));
 45524        this.ShortName = shortName ?? throw new ArgumentNullException(nameof(shortName));
 45525        this.Id = Interlocked.Increment(ref counter);
 45526    }
 27
 28    /// <summary>
 29    /// Gets the name.
 30    /// </summary>
 31    /// <value>
 32    /// The name.
 33    /// </value>
 1683234    public string Name { get; }
 35
 36    /// <summary>
 37    /// Gets the short name.
 38    /// </summary>
 39    /// <value>
 40    /// The short name.
 41    /// </value>
 20842    public string ShortName { get; }
 43
 44    /// <summary>
 45    /// Gets the id of the test method.
 46    /// </summary>
 47    /// <value>
 48    /// The id.
 49    /// </value>
 226050    public long Id { get; }
 51
 52    /// <summary>
 53    /// Returns a <see cref="string" /> that represents this instance.
 54    /// </summary>
 55    /// <returns>
 56    /// A <see cref="string" /> that represents this instance.
 57    /// </returns>
 58    public override string ToString()
 059    {
 060        return this.Name;
 061    }
 62
 63    /// <summary>
 64    /// Determines whether the specified <see cref="object"/> is equal to this instance.
 65    /// </summary>
 66    /// <param name="obj">The <see cref="object"/> to compare with this instance.</param>
 67    /// <returns>
 68    ///   <c>true</c> if the specified <see cref="object"/> is equal to this instance; otherwise, <c>false</c>.
 69    /// </returns>
 70    public override bool Equals(object obj)
 447371    {
 447372        if (obj == null || !obj.GetType().Equals(typeof(TestMethod)))
 073        {
 074            return false;
 75        }
 76        else
 447377        {
 447378            var testMethod = (TestMethod)obj;
 447379            return testMethod.Name.Equals(this.Name);
 80        }
 447381    }
 82
 83    /// <summary>
 84    /// Returns a hash code for this instance.
 85    /// </summary>
 86    /// <returns>
 87    /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
 88    /// </returns>
 783489    public override int GetHashCode() => this.Name.GetHashCode();
 90}