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

Information
Class: ZhEaIsNsAaBn.Infrastructure.Core.InfrastructureBuilder
Assembly: ZhEaIsNsAaBn.Infrastructure.Core
File(s): /home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/DataBasePackages/ZhEaIsNsAaBn.Infrastructure.Core/Registrations/InfrastructureBuilder.cs
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 44
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Build()100%22100%
WithDbContext(...)100%11100%
Record(...)100%11100%

File(s)

/home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/DataBasePackages/ZhEaIsNsAaBn.Infrastructure.Core/Registrations/InfrastructureBuilder.cs

#LineLine coverage
 1namespace ZhEaIsNsAaBn.Infrastructure.Core;
 2
 3/// <summary>Root builder: keeps the recorded registrations and runs them in <see cref="Build"/>.</summary>
 4internal sealed class InfrastructureBuilder : IInfrastructureBuilder
 5{
 1326    private readonly List<Action<IServiceCollection>> _registrations = [];
 7
 8
 1329    internal InfrastructureBuilder( IServiceCollection services )
 10    {
 13211        ArgumentNullException.ThrowIfNull( services );
 12
 13        Services = services;
 13214    }
 15
 16
 17    internal IServiceCollection Services { get; }
 18
 19
 20    public IServiceCollection Build()
 21    {
 71222        foreach ( var registration in _registrations ) { registration( Services ); }
 23
 24
 11625        _registrations.Clear();
 26
 11627        return Services;
 28    }
 29
 30    public IInfrastructureBuilder<TDbContext> WithDbContext< TDbContext >( Action<DbContextOptionsBuilder> dbContextOpti
 31        where TDbContext : DbContext
 32    {
 15233        ArgumentNullException.ThrowIfNull( dbContextOptionsBuilder );
 34
 15235        var builder = new InfrastructureBuilder<TDbContext>( this, dbContextOptionsBuilder );
 36
 37
 15238        Record( builder.Register );
 39
 15240        return builder;
 41    }
 42
 18043    internal void Record( Action<IServiceCollection> registration ) => _registrations.Add( registration );
 44}