< 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: 57_24045730253
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 Channels.ValueObjects;
 4using ValueObjects;
 5
 6public sealed class WatchedTransactionModel
 7{
 88    public ChannelId ChannelId { get; }
 129    public TxId TransactionId { get; }
 4810    public uint RequiredDepth { get; }
 5211    public uint? FirstSeenAtHeight { get; private set; }
 812    public ushort? TransactionIndex { get; private set; }
 1213    public bool IsCompleted { get; private set; }
 14
 1215    public WatchedTransactionModel(ChannelId channelId, TxId transactionId, uint requiredDepth)
 16    {
 1217        ChannelId = channelId;
 1218        TransactionId = transactionId;
 1219        RequiredDepth = requiredDepth;
 1220    }
 21
 22    public void SetHeightAndIndex(uint height, ushort txIndex)
 23    {
 424        if (FirstSeenAtHeight.HasValue)
 025            throw new InvalidOperationException($"{nameof(FirstSeenAtHeight)} is already set.");
 26
 427        if (TransactionIndex.HasValue)
 028            throw new InvalidOperationException($"{nameof(TransactionIndex)} is already set.");
 29
 430        FirstSeenAtHeight = height;
 431        TransactionIndex = txIndex;
 432    }
 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}