< Summary - Combined Code Coverage

Information
Class: NLightning.Transport.Ipc.MessagePack.Formatters.CompactPubKeyNullableFormatter
Assembly: NLightning.Transport.Ipc
File(s): /home/runner/work/NLightning/NLightning/src/NLightning.Transport.Ipc/MessagePack/Formatters/CompactPubKeyNullableFormatter.cs
Tag: 57_24045730253
Line coverage
0%
Covered lines: 0
Uncovered lines: 13
Coverable lines: 13
Total lines: 31
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 8
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Serialize(...)0%620%
Serialize(...)0%620%
Deserialize(...)0%4260%
Deserialize(...)0%4260%

File(s)

/home/runner/work/NLightning/NLightning/src/NLightning.Transport.Ipc/MessagePack/Formatters/CompactPubKeyNullableFormatter.cs

#LineLine coverage
 1using System.Runtime.Serialization;
 2using MessagePack;
 3using MessagePack.Formatters;
 4
 5namespace NLightning.Transport.Ipc.MessagePack.Formatters;
 6
 7using Domain.Crypto.ValueObjects;
 8
 9[ExcludeFormatterFromSourceGeneratedResolver]
 10public class CompactPubKeyNullableFormatter : IMessagePackFormatter<CompactPubKey?>
 11{
 12    public void Serialize(ref MessagePackWriter writer, CompactPubKey? value, MessagePackSerializerOptions options)
 013    {
 014        if (value is null)
 015        {
 016            writer.WriteNil();
 017            return;
 18        }
 19
 020        writer.Write((byte[])value.Value);
 021    }
 22
 23    public CompactPubKey? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
 024    {
 025        if (reader.TryReadNil())
 026            return null;
 27
 028        return reader.ReadBytes()?.FirstSpan.ToArray() ??
 029               throw new SerializationException($"Error deserializing {nameof(CompactPubKey)})");
 030    }
 31}