< Summary

Information
Class: Elsa.Workflows.Runtime.BackgroundWorkflowCancellationDispatcher
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Services/BackgroundWorkflowCancellationDispatcher.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 28
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
DispatchAsync()100%11100%
CreateHeaders()100%22100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Services/BackgroundWorkflowCancellationDispatcher.cs

#LineLine coverage
 1using Elsa.Common.Multitenancy;
 2using Elsa.Mediator;
 3using Elsa.Mediator.Contracts;
 4using Elsa.Tenants.Mediator;
 5using Elsa.Workflows.Runtime.Commands;
 6using Elsa.Workflows.Runtime.Requests;
 7using Elsa.Workflows.Runtime.Responses;
 8
 9namespace Elsa.Workflows.Runtime;
 10
 11/// <summary>
 12///     Dispatches workflow cancellation requests to a local background worker.
 13/// </summary>
 1214public class BackgroundWorkflowCancellationDispatcher(ICommandSender commandSender, ITenantAccessor tenantAccessor) : IW
 15{
 16    /// <inheritdoc />
 17    public async Task<DispatchCancelWorkflowsResponse> DispatchAsync(DispatchCancelWorkflowRequest request, Cancellation
 18    {
 519        var command = new CancelWorkflowsCommand(request);
 520        await commandSender.SendAsync(command, CommandStrategy.Background, CreateHeaders(), cancellationToken);
 521        return new();
 522    }
 23
 24    private IDictionary<object, object> CreateHeaders()
 25    {
 526        return TenantHeaders.CreateHeaders(tenantAccessor.Tenant?.Id);
 27    }
 28}