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

Information
Class: Microsoft.Extensions.DependencyInjection.APIResponsesRegistration
Assembly: ZhEaIsNsAaBn.Utilities.APIResponses
File(s): /home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/UtilitiesPackages/ZhEaIsNsAaBn.Utilities.APIResponses/APIResponsesRegistration.cs
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 28
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
AddAPIResponses(...)100%22100%

File(s)

/home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/UtilitiesPackages/ZhEaIsNsAaBn.Utilities.APIResponses/APIResponsesRegistration.cs

#LineLine coverage
 1using ZhEaIsNsAaBn.Utilities.APIResponses;
 2
 3// ReSharper disable once CheckNamespace
 4namespace Microsoft.Extensions.DependencyInjection;
 5
 6/// <summary>Registers the API response settings.</summary>
 7public static class APIResponsesRegistration
 8{
 9    /// <summary>
 10    /// Registers <see cref="APIResponsesSettings"/> (as <c>IOptions</c>) so <c>ToAPI</c> results map error codes and ca
 11    /// HTTP statuses with the app's overrides. Without this call the built-in defaults apply.
 12    /// </summary>
 13    /// <param name="services">The service collection.</param>
 14    /// <param name="configure">Overrides, e.g. <c>s =&gt; s.MapCode( "PolicyExpired", HttpStatusCode.Gone )</c>.</param
 15    /// <returns>The service collection.</returns>
 16    /// <exception cref="ArgumentNullException"><paramref name="services"/> is <see langword="null"/>.</exception>
 17    public static IServiceCollection AddAPIResponses( this IServiceCollection services, Action<APIResponsesSettings>? co
 18    {
 19819        ArgumentNullException.ThrowIfNull( services );
 20
 19821        var options = services.AddOptions<APIResponsesSettings>();
 22
 23923        if ( configure is not null ) { options.Configure( configure ); }
 24
 25
 19826        return services;
 27    }
 28}