< Summary

Information
Class: MultiProjectApp.Features.Notifications.NotificationsPlugin
Assembly: MultiProjectApp.Features.Notifications
File(s): /home/runner/work/needlr/needlr/src/Examples/MultiProjectApp/MultiProjectApp.Features.Notifications/Notifications.cs
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 28
Line coverage: 100%
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
Configure(...)100%11100%

File(s)

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

#LineLine coverage
 1using Microsoft.Extensions.DependencyInjection;
 2using NexusLabs.Needlr;
 3
 4namespace MultiProjectApp.Features.Notifications;
 5
 6/// <summary>Sends notifications to recipients.</summary>
 7public interface INotificationService
 8{
 9    void Send(string recipient, string message);
 10}
 11
 12/// <summary>In-memory stub implementation of <see cref="INotificationService"/>.</summary>
 13public sealed class InMemoryNotificationService : INotificationService
 14{
 15    public void Send(string recipient, string message) =>
 16        Console.WriteLine($"[Notification] To: {recipient} | {message}");
 17}
 18
 19/// <summary>
 20/// Registers notification services into the DI container.
 21/// </summary>
 22public sealed class NotificationsPlugin : IServiceCollectionPlugin
 23{
 24    public void Configure(ServiceCollectionPluginOptions options)
 25    {
 426        options.Services.AddSingleton<INotificationService, InMemoryNotificationService>();
 427    }
 28}