< Summary - Combined Code Coverage

Information
Class: NLightning.Domain.Bitcoin.Transactions.Models.WatchedTransactionModel
Assembly: NLightning.Domain
File(s): /home/runner/work/nlightning/nlightning/src/NLightning.Domain/Bitcoin/Transactions/Models/WatchedTransactionModel.cs
Tag: 36_15743069263
Line coverage
86%
Covered lines: 19
Uncovered lines: 3
Coverable lines: 22
Total lines: 41
Line coverage: 86.3%
Branch coverage
50%
Covered branches: 3
Total branches: 6
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_ChannelId()100%11100%
get_TransactionId()100%11100%
get_RequiredDepth()100%11100%
get_FirstSeenAtHeight()100%11100%
get_TransactionIndex()100%11100%
get_IsCompleted()100%11100%
.ctor(...)100%11100%
SetHeightAndIndex(...)50%4.37471.43%
MarkAsCompleted()50%2.06275%

File(s)

/home/runner/work/nlightning/nlightning/src/NLightning.Domain/Bitcoin/Transactions/Models/WatchedTransactionModel.cs

#LineLine coverage
 1namespace NLightning.Domain.Bitcoin.Transactions.Models;
 2
 3using NLightning.Domain.Bitcoin.ValueObjects;
 4using NLightning.Domain.Channels.ValueObjects;
 5
 6public class WatchedTransactionModel
 7{
 128    public ChannelId ChannelId { get; }
 169    public TxId TransactionId { get; }
 6010    public uint RequiredDepth { get; }
 6411    public uint? FirstSeenAtHeight { get; private set; }
 1612    public ushort? TransactionIndex { get; private set; }
 1213    public bool IsCompleted { get; private set; }
 14
 1615    public WatchedTransactionModel(ChannelId channelId, TxId transactionId, uint requiredDepth)
 16    {
 1617        ChannelId = channelId;
 1618        TransactionId = transactionId;
 1619        RequiredDepth = requiredDepth;
 1620    }
 21
 22    public void SetHeightAndIndex(uint height, ushort txIndex)
 23    {
 824        if (FirstSeenAtHeight.HasValue)
 025            throw new InvalidOperationException($"{nameof(FirstSeenAtHeight)} is already set.");
 26
 827        if (TransactionIndex.HasValue)
 028            throw new InvalidOperationException($"{nameof(TransactionIndex)} is already set.");
 29
 830        FirstSeenAtHeight = height;
 831        TransactionIndex = txIndex;
 832    }
 33
 34    public void MarkAsCompleted()
 35    {
 436        if (IsCompleted)
 037            throw new InvalidOperationException("Transaction is already marked as completed.");
 38
 439        IsCompleted = true;
 440    }
 41}