< 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: 36_15743069263
Line coverage
84%
Covered lines: 11
Uncovered lines: 2
Coverable lines: 13
Total lines: 52
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%11100%
.ctor(...)100%22100%
.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 Channels.ValueObjects;
 6using Interfaces;
 7using Messages;
 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>
 5232    public byte[]? Data { get; }
 33
 2834    public ErrorPayload(byte[] data)
 35    {
 2836        Data = data;
 2837    }
 38
 1239    public ErrorPayload(ChannelId? channelId, byte[] data) : this(data)
 40    {
 1241        if (channelId.HasValue)
 1242            ChannelId = channelId.Value;
 1243    }
 44
 045    public ErrorPayload(ChannelId? channelId, string message) : this(channelId, Encoding.UTF8.GetBytes(message))
 46    {
 047    }
 48
 1249    public ErrorPayload(string message) : this(Encoding.UTF8.GetBytes(message))
 50    {
 1251    }
 52}