< Summary

Information
Class: NexusLabs.Needlr.Generators.Models.RecordConstructorPrimaryParameter
Assembly: NexusLabs.Needlr.Generators
File(s): /_work/nick-alienware-needlr-1-1784953859-3e8997/needlr/needlr/src/NexusLabs.Needlr.Generators/Models/RecordConstructorOverloads/RecordConstructorPrimaryParameter.cs
Line coverage
66%
Covered lines: 16
Uncovered lines: 8
Coverable lines: 24
Total lines: 73
Line coverage: 66.6%
Branch coverage
37%
Covered branches: 3
Total branches: 8
Branch coverage: 37.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(...)50%66100%
Equals(...)0%620%
GetHashCode()100%210%
op_Equality(...)100%210%
op_Inequality(...)100%210%

File(s)

/_work/nick-alienware-needlr-1-1784953859-3e8997/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    {
 2918        Name = name;
 2919        EscapedName = escapedName;
 2920        TypeName = typeName;
 2921        Documentation = documentation;
 2922    }
 23
 3624    public string Name { get; }
 25
 6226    public string EscapedName { get; }
 27
 3628    public string TypeName { get; }
 29
 3630    public string Documentation { get; }
 31
 32    public bool Equals(RecordConstructorPrimaryParameter other)
 33    {
 534        return string.Equals(Name, other.Name, StringComparison.Ordinal) &&
 535            string.Equals(EscapedName, other.EscapedName, StringComparison.Ordinal) &&
 536            string.Equals(TypeName, other.TypeName, StringComparison.Ordinal) &&
 537            string.Equals(
 538                Documentation,
 539                other.Documentation,
 540                StringComparison.Ordinal);
 41    }
 42
 43    public override bool Equals(object? obj)
 44    {
 045        return obj is RecordConstructorPrimaryParameter other && Equals(other);
 46    }
 47
 48    public override int GetHashCode()
 49    {
 50        unchecked
 51        {
 052            var hash = Name.GetHashCode();
 053            hash = (hash * 397) ^ EscapedName.GetHashCode();
 054            hash = (hash * 397) ^ TypeName.GetHashCode();
 055            hash = (hash * 397) ^ Documentation.GetHashCode();
 056            return hash;
 57        }
 58    }
 59
 60    public static bool operator ==(
 61        RecordConstructorPrimaryParameter left,
 62        RecordConstructorPrimaryParameter right)
 63    {
 064        return left.Equals(right);
 65    }
 66
 67    public static bool operator !=(
 68        RecordConstructorPrimaryParameter left,
 69        RecordConstructorPrimaryParameter right)
 70    {
 071        return !left.Equals(right);
 72    }
 73}