< Summary

Information
Class: NexusLabs.Needlr.Generators.Models.RecordConstructorPropertyParameter
Assembly: NexusLabs.Needlr.Generators
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.Generators/Models/RecordConstructorOverloads/RecordConstructorPropertyParameter.cs
Line coverage
100%
Covered lines: 35
Uncovered lines: 0
Coverable lines: 35
Total lines: 90
Line coverage: 100%
Branch coverage
91%
Covered branches: 11
Total branches: 12
Branch coverage: 91.6%
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_PropertyName()100%11100%
get_EscapedPropertyName()100%11100%
get_TypeName()100%11100%
get_Documentation()100%11100%
get_EffectiveGuards()100%11100%
Equals(...)100%88100%
Equals(...)50%22100%
GetHashCode()100%22100%
op_Equality(...)100%11100%
op_Inequality(...)100%11100%

File(s)

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

#LineLine coverage
 1using System;
 2using System.Linq;
 3
 4namespace NexusLabs.Needlr.Generators.Models;
 5
 6/// <summary>
 7/// A marked record property added to a generated forwarding constructor.
 8/// </summary>
 9internal readonly struct RecordConstructorPropertyParameter :
 10    IEquatable<RecordConstructorPropertyParameter>
 11{
 12    public RecordConstructorPropertyParameter(
 13        string propertyName,
 14        string escapedPropertyName,
 15        string typeName,
 16        string documentation,
 17        ConstructorGuardModel[] effectiveGuards)
 18    {
 10819        PropertyName = propertyName;
 10820        EscapedPropertyName = escapedPropertyName;
 10821        TypeName = typeName;
 10822        Documentation = documentation;
 10823        EffectiveGuards = effectiveGuards;
 10824    }
 25
 24226    public string PropertyName { get; }
 27
 30328    public string EscapedPropertyName { get; }
 29
 16430    public string TypeName { get; }
 31
 14832    public string Documentation { get; }
 33
 20834    public ConstructorGuardModel[] EffectiveGuards { get; }
 35
 36    public bool Equals(RecordConstructorPropertyParameter other)
 37    {
 5538        return string.Equals(
 5539                PropertyName,
 5540                other.PropertyName,
 5541                StringComparison.Ordinal) &&
 5542            string.Equals(
 5543                EscapedPropertyName,
 5544                other.EscapedPropertyName,
 5545                StringComparison.Ordinal) &&
 5546            string.Equals(TypeName, other.TypeName, StringComparison.Ordinal) &&
 5547            string.Equals(
 5548                Documentation,
 5549                other.Documentation,
 5550                StringComparison.Ordinal) &&
 5551            EffectiveGuards.SequenceEqual(other.EffectiveGuards);
 52    }
 53
 54    public override bool Equals(object? obj)
 55    {
 256        return obj is RecordConstructorPropertyParameter other && Equals(other);
 57    }
 58
 59    public override int GetHashCode()
 60    {
 61        unchecked
 62        {
 863            var hash = PropertyName.GetHashCode();
 864            hash = (hash * 397) ^ EscapedPropertyName.GetHashCode();
 865            hash = (hash * 397) ^ TypeName.GetHashCode();
 866            hash = (hash * 397) ^ Documentation.GetHashCode();
 67
 3268            foreach (var guard in EffectiveGuards)
 69            {
 870                hash = (hash * 397) ^ guard.GetHashCode();
 71            }
 72
 873            return hash;
 74        }
 75    }
 76
 77    public static bool operator ==(
 78        RecordConstructorPropertyParameter left,
 79        RecordConstructorPropertyParameter right)
 80    {
 181        return left.Equals(right);
 82    }
 83
 84    public static bool operator !=(
 85        RecordConstructorPropertyParameter left,
 86        RecordConstructorPropertyParameter right)
 87    {
 188        return !left.Equals(right);
 89    }
 90}