< Summary

Information
Class: MRA.DependencyInjection.Startup.ConfigurationStartup
Assembly: MRA.DependencyInjection
File(s): D:\a\MiguelRomerART\MiguelRomerART\MRA.DependencyInjection\Startup\SettingsStartup.cs
Line coverage
100%
Covered lines: 21
Uncovered lines: 0
Coverable lines: 21
Total lines: 39
Line coverage: 100%
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
AddCustomConfiguration(...)100%11100%
GetMRAConfiguration(...)100%11100%

File(s)

D:\a\MiguelRomerART\MiguelRomerART\MRA.DependencyInjection\Startup\SettingsStartup.cs

#LineLine coverage
 1using Microsoft.Extensions.Configuration;
 2using Microsoft.Extensions.DependencyInjection;
 3using MRA.Infrastructure.Settings;
 4using MRA.Infrastructure.Settings.Options;
 5using MRA.Infrastructure.Settings.Sections;
 6
 7namespace MRA.DependencyInjection.Startup;
 8
 9public static class ConfigurationStartup
 10{
 11    public static void AddCustomConfiguration(this IServiceCollection services)
 12    {
 113        services.AddSingleton(sp =>
 114        {
 115            return sp.GetRequiredService<IConfiguration>().GetMRAConfiguration();
 116        });
 117    }
 18
 19    public static AppSettings GetMRAConfiguration(this IConfiguration config)
 20    {
 121        var appConfig = new AppSettings
 122        {
 123            AzureStorage = config.GetSection("AzureStorage").Get<AzureStorageSettings>(),
 124            AzureKeyVault = config.GetSection("AzureKeyVault").Get<AzureKeyVaultSettings>(),
 125            Administrator = config.GetSection("Administrator").Get<AdministratorSettings>(),
 126            Jwt = config.GetSection("Jwt").Get<JwtSettings>(),
 127            Cache = config.GetSection("Cache").Get<CacheSettings>(),
 128            Firebase = config.GetSection("Firebase").Get<FirebaseSettings>(),
 129            MRALogger = config.GetSection("MRALogger").Get<MRALoggerSettings>(),
 130            EPPlus = config.GetSection("EPPlus").Get<EPPlusSettings>(),
 131            AzureCosmosDb = config.GetSection("AzureCosmosDb").Get<AzureCosmosSettings>(),
 132            Database = config.GetSection("Database").Get<DatabaseSettings>(),
 133            RemoteConfig = config.GetSection("RemoteConfig").Get<RemoteConfigSettings>(),
 134            Commands = config.GetSection("Commands").Get<CommandsSettings>()
 135        };
 36
 137        return appConfig;
 38    }
 39}