< Summary - Combined Code Coverage

Information
Class: NLightning.Infrastructure.Persistence.EntityConfiguration.Bitcoin.WalletAddressEntityConfiguration
Assembly: NLightning.Infrastructure.Persistence
File(s): /home/runner/work/NLightning/NLightning/src/NLightning.Infrastructure.Persistence/EntityConfiguration/Bitcoin/WalletAddressEntityConfiguration.cs
Tag: 57_24045730253
Line coverage
0%
Covered lines: 0
Uncovered lines: 16
Coverable lines: 16
Total lines: 28
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
ConfigureWalletAddressEntity(...)100%210%

File(s)

/home/runner/work/NLightning/NLightning/src/NLightning.Infrastructure.Persistence/EntityConfiguration/Bitcoin/WalletAddressEntityConfiguration.cs

#LineLine coverage
 1using Microsoft.EntityFrameworkCore;
 2
 3namespace NLightning.Infrastructure.Persistence.EntityConfiguration.Bitcoin;
 4
 5using Entities.Bitcoin;
 6using Enums;
 7
 8public static class WalletAddressEntityConfiguration
 9{
 10    public static void ConfigureWalletAddressEntity(this ModelBuilder modelBuilder, DatabaseType _)
 11    {
 012        modelBuilder.Entity<WalletAddressEntity>(entity =>
 013        {
 014            // Set Primary Key
 015            entity.HasKey(e => new { e.Index, e.IsChange, e.AddressType });
 016
 017            // Set Required props
 018            entity.Property(e => e.Address)
 019                  .IsRequired();
 020
 021            // Set relations
 022            entity.HasMany(x => x.Utxos)
 023                  .WithOne(x => x.WalletAddress)
 024                  .HasForeignKey(x => new { x.AddressIndex, x.IsAddressChange, x.AddressType })
 025                  .OnDelete(DeleteBehavior.Cascade);
 026        });
 027    }
 28}