< Summary - Combined Code Coverage

Information
Class: NLightning.Domain.Protocol.Payloads.ErrorPayload
Assembly: NLightning.Domain
File(s): /home/runner/work/nlightning/nlightning/src/NLightning.Domain/Protocol/Payloads/ErrorPayload.cs
Tag: 30_15166811759
Line coverage
84%
Covered lines: 11
Uncovered lines: 2
Coverable lines: 13
Total lines: 48
Line coverage: 84.6%
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_ChannelId()100%11100%
get_Data()100%11100%
.ctor(...)100%22100%
.ctor(...)100%11100%
.ctor(...)100%210%
.ctor(...)100%11100%

File(s)

/home/runner/work/nlightning/nlightning/src/NLightning.Domain/Protocol/Payloads/ErrorPayload.cs

#LineLine coverage
 1using System.Text;
 2
 3namespace NLightning.Domain.Protocol.Payloads;
 4
 5using Interfaces;
 6using Messages;
 7using ValueObjects;
 8
 9/// <summary>
 10/// Represents an error payload.
 11/// </summary>
 12/// <remarks>
 13/// An error payload is used to communicate an error to the other party.
 14/// </remarks>
 15/// <seealso cref="ErrorMessage"/>
 16public class ErrorPayload : IMessagePayload
 17{
 18    /// <summary>
 19    /// The channel id.
 20    /// </summary>
 21    /// <remarks>
 22    /// The channel id is used to identify the channel the error is related to.
 23    /// </remarks>
 5624    public ChannelId ChannelId { get; } = ChannelId.Zero;
 25
 26    /// <summary>
 27    /// The error data.
 28    /// </summary>
 29    /// <remarks>
 30    /// The error data is used to communicate the error.
 31    /// </remarks>
 4432    public byte[]? Data { get; }
 33
 2834    public ErrorPayload(byte[] data)
 35    {
 18036        if (data.Any(d => d != 0))
 2437            Data = data;
 2838    }
 39
 1240    public ErrorPayload(ChannelId channelId, byte[] data) : this(data)
 41    {
 1242        ChannelId = channelId;
 1243    }
 044    public ErrorPayload(ChannelId channelId, string message) : this(channelId, Encoding.UTF8.GetBytes(message))
 045    { }
 1246    public ErrorPayload(string message) : this(Encoding.UTF8.GetBytes(message))
 1247    { }
 48}