< Summary

Information
Class: Elsa.Scheduling.Handlers.RunScheduledTaskHandler
Assembly: Elsa.Scheduling
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Scheduling/Handlers/RunScheduledTaskHandler.cs
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 29
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%
HandleAsync()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Scheduling/Handlers/RunScheduledTaskHandler.cs

#LineLine coverage
 1using Elsa.Mediator.Contracts;
 2using Elsa.Mediator.Models;
 3using Elsa.Scheduling.Commands;
 4
 5namespace Elsa.Scheduling.Handlers;
 6
 7/// <summary>
 8/// A command handler for <see cref="RunScheduledTask"/>.
 9/// </summary>
 10public class RunScheduledTaskHandler : ICommandHandler<RunScheduledTask>
 11{
 12    private readonly IServiceProvider _serviceProvider;
 13
 14    /// <summary>
 15    /// Initializes a new instance of the <see cref="RunScheduledTaskHandler"/> class.
 16    /// </summary>
 4517    public RunScheduledTaskHandler(IServiceProvider serviceProvider)
 18    {
 4519        _serviceProvider = serviceProvider;
 4520    }
 21
 22    /// <inheritdoc />
 23    public async Task<Unit> HandleAsync(RunScheduledTask command, CancellationToken cancellationToken)
 24    {
 1125        var taskExecutionContext = new TaskExecutionContext(_serviceProvider, cancellationToken);
 1126        await command.Task.ExecuteAsync(taskExecutionContext);
 1127        return Unit.Instance;
 1128    }
 29}