< Summary

Information
Class: NexusLabs.Needlr.Generators.Models.RecordConstructorPrimaryParameter
Assembly: NexusLabs.Needlr.Generators
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.Generators/Models/RecordConstructorOverloads/RecordConstructorPrimaryParameter.cs
Line coverage
100%
Covered lines: 24
Uncovered lines: 0
Coverable lines: 24
Total lines: 73
Line coverage: 100%
Branch coverage
87%
Covered branches: 7
Total branches: 8
Branch coverage: 87.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_Name()100%11100%
get_EscapedName()100%11100%
get_TypeName()100%11100%
get_Documentation()100%11100%
Equals(...)100%66100%
Equals(...)50%22100%
GetHashCode()100%11100%
op_Equality(...)100%11100%
op_Inequality(...)100%11100%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.Generators/Models/RecordConstructorOverloads/RecordConstructorPrimaryParameter.cs

#LineLine coverage
 1using System;
 2
 3namespace NexusLabs.Needlr.Generators.Models;
 4
 5/// <summary>
 6/// A positional primary-constructor parameter forwarded by a generated record
 7/// constructor overload.
 8/// </summary>
 9internal readonly struct RecordConstructorPrimaryParameter :
 10    IEquatable<RecordConstructorPrimaryParameter>
 11{
 12    public RecordConstructorPrimaryParameter(
 13        string name,
 14        string escapedName,
 15        string typeName,
 16        string documentation)
 17    {
 10818        Name = name;
 10819        EscapedName = escapedName;
 10820        TypeName = typeName;
 10821        Documentation = documentation;
 10822    }
 23
 20624    public string Name { get; }
 25
 25626    public string EscapedName { get; }
 27
 19028    public string TypeName { get; }
 29
 17430    public string Documentation { get; }
 31
 32    public bool Equals(RecordConstructorPrimaryParameter other)
 33    {
 6734        return string.Equals(Name, other.Name, StringComparison.Ordinal) &&
 6735            string.Equals(EscapedName, other.EscapedName, StringComparison.Ordinal) &&
 6736            string.Equals(TypeName, other.TypeName, StringComparison.Ordinal) &&
 6737            string.Equals(
 6738                Documentation,
 6739                other.Documentation,
 6740                StringComparison.Ordinal);
 41    }
 42
 43    public override bool Equals(object? obj)
 44    {
 245        return obj is RecordConstructorPrimaryParameter other && Equals(other);
 46    }
 47
 48    public override int GetHashCode()
 49    {
 50        unchecked
 51        {
 852            var hash = Name.GetHashCode();
 853            hash = (hash * 397) ^ EscapedName.GetHashCode();
 854            hash = (hash * 397) ^ TypeName.GetHashCode();
 855            hash = (hash * 397) ^ Documentation.GetHashCode();
 856            return hash;
 57        }
 58    }
 59
 60    public static bool operator ==(
 61        RecordConstructorPrimaryParameter left,
 62        RecordConstructorPrimaryParameter right)
 63    {
 164        return left.Equals(right);
 65    }
 66
 67    public static bool operator !=(
 68        RecordConstructorPrimaryParameter left,
 69        RecordConstructorPrimaryParameter right)
 70    {
 171        return !left.Equals(right);
 72    }
 73}