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

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

File(s)

/home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/UtilitiesPackages/ZhEaIsNsAaBn.Utilities.PrintPDF/PrintPdfRegistration.cs

#LineLine coverage
 1using Microsoft.Extensions.DependencyInjection.Extensions;
 2using Microsoft.Extensions.Options;
 3using ZhEaIsNsAaBn.Utilities.PrintPDF;
 4
 5// ReSharper disable once CheckNamespace
 6namespace Microsoft.Extensions.DependencyInjection;
 7
 8/// <summary>Registers PDF printing.</summary>
 9public static class PrintPdfRegistration
 10{
 11    /// <summary>
 12    /// Registers <see cref="ChromiumHandler"/> as a singleton (one browser for the app, closed when the container is di
 13    /// with <see cref="ChromiumOptions"/> as <c>IOptions</c>.
 14    /// </summary>
 15    /// <param name="services">The service collection.</param>
 16    /// <param name="configure">Options, e.g. <c>o =&gt; o.ExecutablePath = "/usr/bin/chromium"</c>; <see langword="null
 17    /// <returns>The service collection.</returns>
 18    /// <exception cref="ArgumentNullException"><paramref name="services"/> is <see langword="null"/>.</exception>
 19    public static IServiceCollection AddPrintPdf( this IServiceCollection services, Action<ChromiumOptions>? configure =
 20    {
 421        ArgumentNullException.ThrowIfNull( services );
 22
 423        var options = services.AddOptions<ChromiumOptions>();
 24
 625        if ( configure is not null ) { options.Configure( configure ); }
 26
 27
 428        services.TryAddSingleton( sp => new ChromiumHandler( sp.GetRequiredService<IOptions<ChromiumOptions>>().Value ) 
 29
 430        return services;
 31    }
 32}