< Summary

Information
Class: Elsa.Scheduling.Schedules.CronSchedule
Assembly: Elsa.Scheduling
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Scheduling/Schedules/CronSchedule.cs
Line coverage
100%
Covered lines: 5
Uncovered lines: 0
Coverable lines: 5
Total lines: 32
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_CronExpression()100%11100%
Schedule(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Scheduling/Schedules/CronSchedule.cs

#LineLine coverage
 1using Elsa.Scheduling.ScheduledTasks;
 2using JetBrains.Annotations;
 3using Microsoft.Extensions.DependencyInjection;
 4
 5namespace Elsa.Scheduling.Schedules;
 6
 7/// <summary>
 8/// A CRON schedule.
 9/// </summary>
 10[PublicAPI]
 11public class CronSchedule : ISchedule
 12{
 13    /// <summary>
 14    /// Initializes a new instance of the <see cref="CronSchedule"/> class.
 15    /// </summary>
 16    /// <param name="cronExpression">The CRON expression.</param>
 217    public CronSchedule(string cronExpression)
 18    {
 219        CronExpression = cronExpression;
 220    }
 21
 22    /// <summary>
 23    /// The CRON expression.
 24    /// </summary>
 425    public string CronExpression { get; init; }
 26
 27    /// <summary>
 28    /// Creates a <see cref="ScheduledCronTask"/>.
 29    /// </summary>
 30    public IScheduledTask Schedule(ScheduleContext context) =>
 231        ActivatorUtilities.CreateInstance<ScheduledCronTask>(context.ServiceProvider, context.Task, CronExpression);
 32}