< Summary

Information
Class: Elsa.Scheduling.Features.SchedulingFeature
Assembly: Elsa.Scheduling
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Scheduling/Features/SchedulingFeature.cs
Line coverage
100%
Covered lines: 22
Uncovered lines: 0
Coverable lines: 22
Total lines: 60
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
.ctor(...)100%11100%
get_WorkflowScheduler()100%11100%
get_CronParser()100%11100%
Apply()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Scheduling/Features/SchedulingFeature.cs

#LineLine coverage
 1using Elsa.Common.Features;
 2using Elsa.Common.Multitenancy;
 3using Elsa.Extensions;
 4using Elsa.Features.Abstractions;
 5using Elsa.Features.Attributes;
 6using Elsa.Features.Services;
 7using Elsa.Scheduling.Bookmarks;
 8using Elsa.Scheduling.Handlers;
 9using Elsa.Scheduling.HostedServices;
 10using Elsa.Scheduling.Services;
 11using Elsa.Scheduling.TriggerPayloadValidators;
 12using Elsa.Workflows.Management.Features;
 13using Microsoft.Extensions.DependencyInjection;
 14
 15namespace Elsa.Scheduling.Features;
 16
 17/// <summary>
 18/// Provides scheduling features to the system.
 19/// </summary>
 20[DependsOn(typeof(SystemClockFeature))]
 21public class SchedulingFeature : FeatureBase
 22{
 23    /// <inheritdoc />
 16724    public SchedulingFeature(IModule module) : base(module)
 25    {
 16726    }
 27
 28    /// <summary>
 29    /// Gets or sets the trigger scheduler.
 30    /// </summary>
 78731    public Func<IServiceProvider, IWorkflowScheduler> WorkflowScheduler { get; set; } = sp => sp.GetRequiredService<Defa
 32
 33    /// <summary>
 34    /// Gets or sets the CRON parser.
 35    /// </summary>
 33736    public Func<IServiceProvider, ICronParser> CronParser { get; set; } = sp => sp.GetRequiredService<CronosCronParser>(
 37
 38    /// <inheritdoc />
 39    public override void Apply()
 40    {
 16741        Services
 16742            .AddSingleton<UpdateTenantSchedules>()
 143            .AddSingleton<ITenantActivatedEvent>(sp => sp.GetRequiredService<UpdateTenantSchedules>())
 144            .AddSingleton<ITenantDeletedEvent>(sp => sp.GetRequiredService<UpdateTenantSchedules>())
 16745            .AddSingleton<IScheduler, LocalScheduler>()
 16746            .AddSingleton<CronosCronParser>()
 16747            .AddSingleton(CronParser)
 16748            .AddScoped<ITriggerScheduler, DefaultTriggerScheduler>()
 16749            .AddScoped<IBookmarkScheduler, DefaultBookmarkScheduler>()
 16750            .AddScoped<DefaultWorkflowScheduler>()
 16751            .AddScoped(WorkflowScheduler)
 16752            .AddBackgroundTask<CreateSchedulesBackgroundTask>()
 16753            .AddHandlersFrom<ScheduleWorkflows>()
 16754
 16755            //Trigger payload validators.
 16756            .AddTriggerPayloadValidator<CronTriggerPayloadValidator, CronTriggerPayload>();
 57
 33458        Module.Configure<WorkflowManagementFeature>(management => management.AddActivitiesFrom<SchedulingFeature>());
 16759    }
 60}