< Summary

Information
Class: Pomodoro.Web.Services.ServiceRegistrationService
Assembly: Pomodoro.Web
File(s): /home/runner/work/Pomodoro/Pomodoro/src/Pomodoro.Web/Services/ServiceRegistrationService.cs
Line coverage
100%
Covered lines: 37
Uncovered lines: 0
Coverable lines: 37
Total lines: 71
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
.ctor(...)100%11100%
RegisterServices(...)100%22100%

File(s)

/home/runner/work/Pomodoro/Pomodoro/src/Pomodoro.Web/Services/ServiceRegistrationService.cs

#LineLine coverage
 1using Microsoft.Extensions.DependencyInjection;
 2using Microsoft.Extensions.Logging;
 3using Pomodoro.Web.Models;
 4using Pomodoro.Web.Services.Formatters;
 5using Pomodoro.Web.Services.Repositories;
 6
 7namespace Pomodoro.Web.Services;
 8
 9/// <summary>
 10/// Service for re6gistering all application services with DI container.
 11/// Extracted from Program.cs for testability.
 12/// </summary>
 13public interface IServiceRegistrationService
 14{
 15    void RegisterServices(IServiceCollection services);
 16}
 17
 18public class ServiceRegistrationService : IServiceRegistrationService
 19{
 20    private readonly ILogger<ServiceRegistrationService>? _logger;
 21
 3122    public ServiceRegistrationService(ILogger<ServiceRegistrationService>? logger = null)
 3123    {
 3124        _logger = logger;
 3125    }
 26
 27    public void RegisterServices(IServiceCollection services)
 2828    {
 29        // Register AppState as singleton-like scoped service
 2830        services.AddScoped<AppState>();
 31
 32        // Register IndexedDB service (must be registered before services that depend on it)
 2833        services.AddScoped<IIndexedDbService, IndexedDbService>();
 34
 35        // Register repositories (must be registered before services that depend on them)
 2836        services.AddScoped<ITaskRepository, TaskRepository>();
 2837        services.AddScoped<IActivityRepository, ActivityRepository>();
 2838        services.AddScoped<ISettingsRepository, SettingsRepository>();
 39
 40        // Register services that use repositories and implement ITimerEventSubscriber
 2841        services.AddScoped<ITaskService, TaskService>();
 2842        services.AddScoped<IActivityService, ActivityService>();
 2843        services.AddScoped<ITimerService, TimerService>();
 2844        services.AddScoped<ISessionOptionsService, SessionOptionsService>();
 2845        services.AddScoped<IConsentService, ConsentService>();
 2846        services.AddScoped<INotificationService, NotificationService>();
 2847        services.AddScoped<IPipTimerService, PipTimerService>();
 2848        services.AddScoped<ChartService>();
 2849        services.AddScoped<IKeyboardShortcutService, KeyboardShortcutService>();
 2850        services.AddScoped<IExportService, ExportService>();
 51
 52        // Register formatter services for components (enables testable code with coverage tracking)
 2853        services.AddScoped<StatCardFormatter>();
 2854        services.AddScoped<ActivityItemFormatter>();
 2855        services.AddScoped<ActivityTimelineFormatter>();
 2856        services.AddScoped<TimeFormatter>();
 2857        services.AddScoped<ChartDataFormatter>();
 2858        services.AddScoped<TimerThemeFormatter>();
 2859        services.AddScoped<SummaryCardsFormatter>();
 2860        services.AddScoped<ITodayStatsService, TodayStatsService>();
 2861        services.AddScoped<IHistoryStatsService, HistoryStatsService>();
 2862        services.AddScoped<SettingsPresenterService>();
 2863        services.AddScoped<HistoryPagePresenterService>();
 2864        services.AddScoped<IndexPagePresenterService>();
 2865        services.AddScoped<IJSInteropService, JSInteropService>();
 2866        services.AddScoped<IInfiniteScrollInterop, InfiniteScrollInterop>();
 2867        services.AddScoped<ILocalDateTimeService, LocalDateTimeService>();
 68
 2869        _logger?.LogInformation("All services registered successfully");
 2870    }
 71}