< Summary - ZhEaIsNsAaBn.Libraries coverage (affected: 23 packages)

Information
Line coverage
100%
Covered lines: 16
Uncovered lines: 0
Coverable lines: 16
Total lines: 53
Line coverage: 100%
Branch coverage
87%
Covered branches: 7
Total branches: 8
Branch coverage: 87.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_Warnings()100%11100%
SetRole(...)100%22100%
SetMatchBy(...)100%22100%
SetDeleteMode(...)100%22100%
Ignore(...)50%22100%

File(s)

/home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/DataBasePackages/ZhEaIsNsAaBn.DbSeeder/Configuration/SeedEntitySettings.cs

#LineLine coverage
 1namespace ZhEaIsNsAaBn.DbSeeder;
 2
 3/// What the seed configuration says about one entity type (step 1 of the resolution order). Setting something twice: la
 4internal sealed class SeedEntitySettings
 5{
 346    private readonly List<string> _warnings = [];
 7
 8
 349    internal SeedEntitySettings( Type clrType ) => ClrType = clrType;
 10
 11
 12    public Type ClrType { get; }
 13
 14    public Dictionary<SeedRole, string> Roles { get; } = [];
 15
 3416    public HashSet<string> Ignored { get; } = new( StringComparer.Ordinal );
 17
 18    public IReadOnlyList<string>? MatchBy { get; private set; }
 19
 20    public SeedDeleteMode? DeleteMode { get; private set; }
 21
 2822    public IReadOnlyList<string> Warnings => _warnings;
 23
 24
 25    public void SetRole( SeedRole role, string propertyName )
 26    {
 1527        if ( Roles.TryGetValue( role, out var previous ) )
 28        {
 329            _warnings.Add( $"{ClrType.Name}: {role} is set twice ({previous}, then {propertyName}); the last one wins." 
 30        }
 31
 1532        Roles[ role ] = propertyName;
 1533    }
 34
 35    public void SetMatchBy( IReadOnlyList<string> propertyNames )
 36    {
 2737        if ( MatchBy is not null ) { _warnings.Add( $"{ClrType.Name}: MatchBy is set twice; the last one wins." ); }
 38
 2139        MatchBy = propertyNames;
 2140    }
 41
 42    public void SetDeleteMode( SeedDeleteMode mode )
 43    {
 2844        if ( DeleteMode is not null ) { _warnings.Add( $"{ClrType.Name}: DeleteMode is set twice ({DeleteMode}, then {mo
 45
 2246        DeleteMode = mode;
 2247    }
 48
 49    public void Ignore( string propertyName )
 50    {
 351        if ( !Ignored.Add( propertyName ) ) { _warnings.Add( $"{ClrType.Name}: {propertyName} is ignored twice." ); }
 352    }
 53}