< Summary - Combined Code Coverage

Information
Class: NLightning.Domain.Crypto.ValueObjects.PrivKey
Assembly: NLightning.Domain
File(s): /home/runner/work/nlightning/nlightning/src/NLightning.Domain/Crypto/ValueObjects/PrivKey.cs
Tag: 36_15743069263
Line coverage
77%
Covered lines: 7
Uncovered lines: 2
Coverable lines: 9
Total lines: 29
Line coverage: 77.7%
Branch coverage
50%
Covered branches: 2
Total branches: 4
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Value()100%11100%
.ctor(...)50%4.13480%
op_Implicit(...)100%11100%
op_Implicit(...)100%11100%
op_Implicit(...)100%210%

File(s)

/home/runner/work/nlightning/nlightning/src/NLightning.Domain/Crypto/ValueObjects/PrivKey.cs

#LineLine coverage
 1namespace NLightning.Domain.Crypto.ValueObjects;
 2
 3using Constants;
 4
 5public readonly record struct PrivKey
 6{
 7    /// <summary>
 8    /// The private key value.
 9    /// </summary>
 20810    public byte[] Value { get; }
 11
 12    /// <summary>
 13    /// Initializes a new instance of the <see cref="PrivKey"/> struct.
 14    /// </summary>
 15    /// <param name="value">The private key value.</param>
 16    public PrivKey(byte[] value)
 17    {
 20418        ArgumentNullException.ThrowIfNull(value);
 20419        if (value is null || value.Length != CryptoConstants.PrivkeyLen)
 020            throw new ArgumentException($"Private key must be {CryptoConstants.PrivkeyLen} bytes long.", nameof(value));
 21
 20422        Value = value;
 20423    }
 24
 20425    public static implicit operator PrivKey(byte[] bytes) => new(bytes);
 20826    public static implicit operator byte[](PrivKey hash) => hash.Value;
 27
 028    public static implicit operator ReadOnlySpan<byte>(PrivKey hash) => hash.Value;
 29}