< Summary - Combined Code Coverage

Information
Class: NLightning.Domain.Bitcoin.ValueObjects.BlockchainState
Assembly: NLightning.Domain
File(s): /home/runner/work/nlightning/nlightning/src/NLightning.Domain/Bitcoin/ValueObjects/BlockchainState.cs
Tag: 36_15743069263
Line coverage
93%
Covered lines: 14
Uncovered lines: 1
Coverable lines: 15
Total lines: 28
Line coverage: 93.3%
Branch coverage
50%
Covered branches: 1
Total branches: 2
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_Id()100%11100%
get_LastProcessedBlockHash()100%11100%
get_LastProcessedHeight()100%11100%
get_LastProcessedAt()100%11100%
.ctor(...)100%11100%
UpdateState(...)50%2.02283.33%

File(s)

/home/runner/work/nlightning/nlightning/src/NLightning.Domain/Bitcoin/ValueObjects/BlockchainState.cs

#LineLine coverage
 1namespace NLightning.Domain.Bitcoin.ValueObjects;
 2
 3using Crypto.ValueObjects;
 4
 5public record BlockchainState
 6{
 447    public Guid Id { get; init; } = Guid.NewGuid();
 5368    public Hash LastProcessedBlockHash { get; private set; }
 10209    public uint LastProcessedHeight { get; private set; }
 52810    public DateTime LastProcessedAt { get; private set; }
 11
 4412    public BlockchainState(uint lastProcessedHeight, Hash lastProcessedBlockHash, DateTime lastProcessedAt)
 13    {
 4414        LastProcessedHeight = lastProcessedHeight;
 4415        LastProcessedBlockHash = lastProcessedBlockHash;
 4416        LastProcessedAt = lastProcessedAt;
 4417    }
 18
 19    public void UpdateState(Hash newBlockHash, uint newBlockHeight)
 20    {
 48421        if (newBlockHeight < LastProcessedHeight)
 022            throw new InvalidOperationException("New block height cannot be lower than the last processed height.");
 23
 48424        LastProcessedBlockHash = newBlockHash;
 48425        LastProcessedHeight = newBlockHeight;
 48426        LastProcessedAt = DateTime.UtcNow;
 48427    }
 28}