< Summary

Information
Class: Elsa.Scheduling.Activities.Timer
Assembly: Elsa.Scheduling
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Scheduling/Activities/Timer.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 51
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%
.ctor(...)100%11100%
.ctor(...)100%11100%
get_Interval()100%11100%
GetInterval(...)100%11100%
FromTimeSpan(...)100%11100%
FromSeconds(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Scheduling/Activities/Timer.cs

#LineLine coverage
 1using System.Runtime.CompilerServices;
 2using Elsa.Expressions.Models;
 3using Elsa.Extensions;
 4using Elsa.Workflows.Attributes;
 5using Elsa.Workflows.Models;
 6
 7namespace Elsa.Scheduling.Activities;
 8
 9/// <summary>
 10/// Represents a timer to periodically trigger the workflow.
 11/// </summary>
 12[Activity("Elsa", "Scheduling", "Trigger workflow execution at a specific interval.")]
 13public class Timer : TimerBase
 14{
 15    /// <inheritdoc />
 3116    public Timer([CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(source, line)
 17    {
 3118    }
 19
 20    /// <inheritdoc />
 2621    public Timer(TimeSpan interval, [CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : this(
 22    {
 2623    }
 24
 25    /// <inheritdoc />
 2626    public Timer(Input<TimeSpan> interval, [CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) 
 27    {
 2628        Interval = interval;
 2629    }
 30
 31    /// <summary>
 32    /// The interval at which the timer should execute.
 33    /// </summary>
 34    [Input(Description = "The interval at which the timer should execute.", DefaultValue = "00:01:00")]
 14235    public Input<TimeSpan> Interval { get; set; } = new(TimeSpan.FromMinutes(1));
 36
 37    protected override TimeSpan GetInterval(ExpressionExecutionContext context)
 38    {
 1139        return Interval.Get(context);
 40    }
 41
 42    /// <summary>
 43    /// Creates a new <see cref="Timer"/> activity set to trigger at the specified interval.
 44    /// </summary>
 2245    public static Timer FromTimeSpan(TimeSpan value, [CallerFilePath] string? source = null, [CallerLineNumber] int? lin
 46
 47    /// <summary>
 48    /// Creates a new <see cref="Timer"/> activity set to trigger at the specified interval in seconds.
 49    /// </summary>
 2050    public static Timer FromSeconds(double value, [CallerFilePath] string? source = null, [CallerLineNumber] int? line =
 51}