< Summary

Information
Class: Elsa.Scheduling.Tasks.DelegateTask
Assembly: Elsa.Scheduling
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Scheduling/Tasks/DelegateTask.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 2
Coverable lines: 2
Total lines: 21
Line coverage: 0%
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%210%
ExecuteAsync(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Scheduling/Tasks/DelegateTask.cs

#LineLine coverage
 1using JetBrains.Annotations;
 2
 3namespace Elsa.Scheduling.Tasks;
 4
 5/// <summary>
 6/// A generic task that executes the provided delegate.
 7/// </summary>
 8[PublicAPI]
 9public class DelegateTask : ITask
 10{
 11    private readonly Func<TaskExecutionContext, ValueTask> _task;
 12
 13    /// <summary>
 14    /// Initializes a new instance of the <see cref="DelegateTask"/> class.
 15    /// </summary>
 16    /// <param name="task">The delegate to execute.</param>
 017    public DelegateTask(Func<TaskExecutionContext, ValueTask> task) => _task = task;
 18
 19    /// <inheritdoc />
 020    public ValueTask ExecuteAsync(TaskExecutionContext context) => _task(context);
 21}