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

Information
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 26
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
GetValue(...)100%66100%

File(s)

/home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/DataBasePackages/ZhEaIsNsAaBn.ViewModels/DTOs/AppSettings/EnvironmentHelper.cs

#LineLine coverage
 1namespace ZhEaIsNsAaBn.ViewModels;
 2
 3/// <summary>Picks the value for the current environment from an <see cref="EnvironmentBaseSettings"/>.</summary>
 4public static class EnvironmentHelper
 5{
 6    /// <summary>The current environment. Set it once at startup; if it isn't set, <see cref="GetValue"/> returns the UA
 7    public static EnvironmentSettings? Settings { get; set; }
 8
 9
 10    /// <summary>Gets the value for the current environment.</summary>
 11    /// <param name="envSettings">The per-environment values.</param>
 12    /// <returns><see cref="EnvironmentBaseSettings.Dev"/> in development, <see cref="EnvironmentBaseSettings.Production
 13    /// <exception cref="ArgumentNullException"><paramref name="envSettings"/> is <see langword="null"/>.</exception>
 14    public static string GetValue( this EnvironmentBaseSettings envSettings )
 15    {
 1616        ArgumentNullException.ThrowIfNull( envSettings );
 17
 18
 1219        return Settings switch
 1220               {
 421                   { IsDevelopment: true } => envSettings.Dev,
 422                   { IsProduction: true }  => envSettings.Production,
 423                   _                       => envSettings.UAT
 1224               };
 25    }
 26}