< Summary

Information
Class: ArturRios.Data.Export.Excel.DependencyInjection.ServiceCollectionExtensions
Assembly: ArturRios.Data.Export.Excel
File(s): D:\Repositories\dotnet-data\src\ArturRios.Data.Export.Excel\DependencyInjection\ServiceCollectionExtensions.cs
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 28
Line coverage: 100%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage
100%
Covered methods: 1
Fully covered methods: 0
Total methods: 1
Method coverage: 100%
Full method coverage: 0%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
AddExcelExport(...)50%22100%

File(s)

D:\Repositories\dotnet-data\src\ArturRios.Data.Export.Excel\DependencyInjection\ServiceCollectionExtensions.cs

#LineLine coverage
 1using ArturRios.Data.Export.Abstractions;
 2using ArturRios.Data.Export.Excel.Configuration;
 3using ArturRios.Data.Export.Excel.Exporters;
 4using Microsoft.Extensions.DependencyInjection;
 5
 6namespace ArturRios.Data.Export.Excel.DependencyInjection;
 7
 8/// <summary>Dependency-injection registration for the Excel export add-on.</summary>
 9public static class ServiceCollectionExtensions
 10{
 11    /// <param name="services">The service collection.</param>
 12    extension(IServiceCollection services)
 13    {
 14        /// <summary>Registers the Excel exporter and makes the exporter factory resolve <see cref="ExportFormat.Excel" 
 15        /// <param name="configure">Optional Excel options configuration.</param>
 16        public IServiceCollection AddExcelExport(Action<ExcelExportOptions>? configure = null)
 117        {
 118            var options = new ExcelExportOptions();
 119            configure?.Invoke(options);
 20
 121            services.AddSingleton(options);
 122            services.AddSingleton(typeof(ExcelExporter<>));
 123            services.AddSingleton(new ExcelExporterRegistration(typeof(ExcelExporter<>)));
 24
 125            return services;
 26        }
 27    }
 28}