< Summary - Combined Code Coverage

Information
Class: NLightning.Domain.ValueObjects.Witness
Assembly: NLightning.Domain
File(s): /home/runner/work/nlightning/nlightning/src/NLightning.Domain/ValueObjects/Witness.cs
Tag: 30_15166811759
Line coverage
54%
Covered lines: 6
Uncovered lines: 5
Coverable lines: 11
Total lines: 48
Line coverage: 54.5%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Length()100%11100%
.ctor(...)100%11100%
Equals(...)100%11100%
Equals(...)0%620%
GetHashCode()100%210%
op_Implicit(...)100%11100%
op_Implicit(...)100%210%
op_Implicit(...)100%11100%
op_Equality(...)100%210%
op_Inequality(...)100%210%

File(s)

/home/runner/work/nlightning/nlightning/src/NLightning.Domain/ValueObjects/Witness.cs

#LineLine coverage
 1namespace NLightning.Domain.ValueObjects;
 2
 3using Interfaces;
 4
 5public readonly struct Witness : IValueObject, IEquatable<Witness>
 6{
 7    private readonly byte[] _value;
 8
 169    public ushort Length => (ushort)_value.Length;
 10
 11    public Witness(byte[] value)
 12    {
 4013        _value = value;
 4014    }
 15
 16    #region Equality
 17    public bool Equals(Witness other)
 18    {
 419        return _value.SequenceEqual(other._value);
 20    }
 21
 22    public override bool Equals(object? obj)
 23    {
 024        return obj is Witness other && Equals(other);
 25    }
 26
 27    public override int GetHashCode()
 28    {
 029        return _value.GetHashCode();
 30    }
 31    #endregion
 32
 33    #region Implicit Operators
 1234    public static implicit operator byte[](Witness s) => s._value;
 035    public static implicit operator Witness(byte[] value) => new(value);
 1636    public static implicit operator ReadOnlyMemory<byte>(Witness s) => s._value;
 37
 38    public static bool operator ==(Witness left, Witness right)
 39    {
 040        return left.Equals(right);
 41    }
 42
 43    public static bool operator !=(Witness left, Witness right)
 44    {
 045        return !(left == right);
 46    }
 47    #endregion
 48}