< Summary - Combined Code Coverage

Information
Class: NLightning.Domain.Bitcoin.ValueObjects.Witness
Assembly: NLightning.Domain
File(s): /home/runner/work/nlightning/nlightning/src/NLightning.Domain/Bitcoin/ValueObjects/Witness.cs
Tag: 36_15743069263
Line coverage
66%
Covered lines: 6
Uncovered lines: 3
Coverable lines: 9
Total lines: 39
Line coverage: 66.6%
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%
op_Implicit(...)100%11100%
op_Implicit(...)100%210%
op_Implicit(...)100%11100%
Equals(...)100%11100%
Equals(...)0%620%
GetHashCode()100%210%

File(s)

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

#LineLine coverage
 1namespace NLightning.Domain.Bitcoin.ValueObjects;
 2
 3using Domain.Interfaces;
 4using Utils.Extensions;
 5
 6public readonly struct Witness : IValueObject, IEquatable<Witness>
 7{
 8    private readonly byte[] _value;
 9
 1610    public ushort Length => (ushort)_value.Length;
 11
 12    public Witness(byte[] value)
 13    {
 4014        _value = value;
 4015    }
 16
 17    #region Implicit Operators
 18
 1219    public static implicit operator byte[](Witness s) => s._value;
 020    public static implicit operator Witness(byte[] value) => new(value);
 1621    public static implicit operator ReadOnlyMemory<byte>(Witness s) => s._value;
 22
 23    #endregion
 24
 25    public bool Equals(Witness other)
 26    {
 427        return _value.SequenceEqual(other._value);
 28    }
 29
 30    public override bool Equals(object? obj)
 31    {
 032        return obj is Witness other && Equals(other);
 33    }
 34
 35    public override int GetHashCode()
 36    {
 037        return _value.GetByteArrayHashCode();
 38    }
 39}