< Summary - Combined Code Coverage

Information
Class: NLightning.Domain.Protocol.Tlv.NetworksTlv
Assembly: NLightning.Domain
File(s): /home/runner/work/nlightning/nlightning/src/NLightning.Domain/Protocol/Tlv/NetworksTLV.cs
Tag: 30_15166811759
Line coverage
100%
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 36
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_ChainHashes()100%11100%
.ctor(...)100%22100%

File(s)

/home/runner/work/nlightning/nlightning/src/NLightning.Domain/Protocol/Tlv/NetworksTLV.cs

#LineLine coverage
 1namespace NLightning.Domain.Protocol.Tlv;
 2
 3using Constants;
 4using ValueObjects;
 5
 6/// <summary>
 7/// Networks TLV.
 8/// </summary>
 9/// <remarks>
 10/// The networks TLV is used in the InitMessage to communicate the networks that the node supports.
 11/// </remarks>
 12public class NetworksTlv : BaseTlv
 13{
 14    /// <summary>
 15    /// The chain hashes.
 16    /// </summary>
 17    /// <remarks>
 18    /// The chain hashes are the hashes of the chains that the node supports.
 19    /// </remarks>
 28020    public IEnumerable<ChainHash>? ChainHashes { get; }
 21
 6822    public NetworksTlv(IEnumerable<ChainHash> chainHashes) : base(TlvConstants.NETWORKS)
 23    {
 6824        ChainHashes = chainHashes.ToList();
 25
 6826        Value = new byte[ChainHash.LENGTH * ChainHashes.Count()];
 27
 27228        for (var i = 0; i < ChainHashes.Count(); i++)
 29        {
 6830            byte[] chainHash = ChainHashes.ElementAt(i);
 6831            chainHash.CopyTo(Value, i * ChainHash.LENGTH);
 32        }
 33
 6834        Length = Value.Length;
 6835    }
 36}