< Summary

Information
Class: MultiProjectApp.Features.Reporting.ConsoleReportService
Assembly: MultiProjectApp.Features.Reporting
File(s): /home/runner/work/needlr/needlr/src/Examples/MultiProjectApp/MultiProjectApp.Features.Reporting/Reporting.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 2
Coverable lines: 2
Total lines: 40
Line coverage: 0%
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
Generate(...)100%210%

File(s)

/home/runner/work/needlr/needlr/src/Examples/MultiProjectApp/MultiProjectApp.Features.Reporting/Reporting.cs

#LineLine coverage
 1using Microsoft.Extensions.DependencyInjection;
 2using NexusLabs.Needlr;
 3
 4namespace MultiProjectApp.Features.Reporting;
 5
 6/// <summary>Generates simple text reports.</summary>
 7public interface IReportService
 8{
 9    string Generate(string title, IEnumerable<string> items);
 10}
 11
 12/// <summary>Stub implementation of <see cref="IReportService"/>.</summary>
 13public sealed class ConsoleReportService : IReportService
 14{
 15    public string Generate(string title, IEnumerable<string> items)
 16    {
 017        var lines = items.ToList();
 018        return $"=== {title} ===\n{string.Join("\n", lines.Select((l, i) => $"  {i + 1}. {l}"))}\n({lines.Count} items)"
 19    }
 20}
 21
 22/// <summary>
 23/// Helper class intentionally decorated with [DoNotAutoRegister] — this is the correct
 24/// usage pattern: preventing a non-plugin helper from being auto-registered as a DI service.
 25/// Compare with the Bootstrap project which shows the INCORRECT (and now warned) usage.
 26/// </summary>
 27[DoNotAutoRegister]
 28public sealed class ReportingInternals
 29{
 30    public static string FormatHeader(string title) => $"=== {title} ===";
 31}
 32
 33/// <summary>Registers reporting services into the DI container.</summary>
 34public sealed class ReportingPlugin : IServiceCollectionPlugin
 35{
 36    public void Configure(ServiceCollectionPluginOptions options)
 37    {
 38        options.Services.AddSingleton<IReportService, ConsoleReportService>();
 39    }
 40}