< Summary - Combined Code Coverage

Information
Class: NLightning.Infrastructure.Persistence.Contexts.NLightningDbContext
Assembly: NLightning.Infrastructure.Persistence
File(s): /home/runner/work/nlightning/nlightning/src/NLightning.Infrastructure.Persistence/Contexts/NLightningDbContext.cs
Tag: 36_15743069263
Line coverage
0%
Covered lines: 0
Uncovered lines: 19
Coverable lines: 19
Total lines: 54
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
get_BlockchainStates()100%210%
get_WatchedTransactions()100%210%
get_Channels()100%210%
get_ChannelConfigs()100%210%
get_ChannelKeySets()100%210%
get_Htlcs()100%210%
get_Peers()100%210%
OnModelCreating(...)100%210%

File(s)

/home/runner/work/nlightning/nlightning/src/NLightning.Infrastructure.Persistence/Contexts/NLightningDbContext.cs

#LineLine coverage
 1using Microsoft.EntityFrameworkCore;
 2
 3namespace NLightning.Infrastructure.Persistence.Contexts;
 4
 5using Entities.Bitcoin;
 6using Entities.Channel;
 7using Entities.Node;
 8using EntityConfiguration.Bitcoin;
 9using EntityConfiguration.Channel;
 10using EntityConfiguration.Node;
 11using Enums;
 12using Providers;
 13
 14public class NLightningDbContext : DbContext
 15{
 16    private readonly DatabaseType _databaseType;
 17
 18    public NLightningDbContext(DbContextOptions<NLightningDbContext> options, DatabaseTypeProvider databaseTypeProvider)
 019        : base(options)
 20    {
 021        _databaseType = databaseTypeProvider.DatabaseType;
 022    }
 23
 24    // Bitcoin DbSets
 025    public DbSet<BlockchainStateEntity> BlockchainStates { get; set; }
 026    public DbSet<WatchedTransactionEntity> WatchedTransactions { get; set; }
 27
 28    // Channel DbSets
 029    public DbSet<ChannelEntity> Channels { get; set; }
 030    public DbSet<ChannelConfigEntity> ChannelConfigs { get; set; }
 031    public DbSet<ChannelKeySetEntity> ChannelKeySets { get; set; }
 032    public DbSet<HtlcEntity> Htlcs { get; set; }
 33
 34    // Node DbSets
 035    public DbSet<PeerEntity> Peers { get; set; }
 36
 37    protected override void OnModelCreating(ModelBuilder modelBuilder)
 38    {
 039        base.OnModelCreating(modelBuilder);
 40
 41        // Bitcoin entities
 042        modelBuilder.ConfigureBlockchainStateEntity(_databaseType);
 043        modelBuilder.ConfigureWatchedTransactionEntity(_databaseType);
 44
 45        // Channel entities
 046        modelBuilder.ConfigureChannelEntity(_databaseType);
 047        modelBuilder.ConfigureChannelConfigEntity(_databaseType);
 048        modelBuilder.ConfigureChannelKeySetEntity(_databaseType);
 049        modelBuilder.ConfigureHtlcEntity(_databaseType);
 50
 51        // Node entities
 052        modelBuilder.ConfigurePeerEntity(_databaseType);
 053    }
 54}