< 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
16%
Covered lines: 1
Uncovered lines: 5
Coverable lines: 6
Total lines: 28
Line coverage: 16.6%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
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%210%
CreateHeaders()0%620%

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>
 314public class BackgroundWorkflowCancellationDispatcher(ICommandSender commandSender, ITenantAccessor tenantAccessor) : IW
 15{
 16    /// <inheritdoc />
 17    public async Task<DispatchCancelWorkflowsResponse> DispatchAsync(DispatchCancelWorkflowRequest request, Cancellation
 18    {
 019        var command = new CancelWorkflowsCommand(request);
 020        await commandSender.SendAsync(command, CommandStrategy.Background, CreateHeaders(), cancellationToken);
 021        return new DispatchCancelWorkflowsResponse();
 022    }
 23
 24    private IDictionary<object, object> CreateHeaders()
 25    {
 026        return TenantHeaders.CreateHeaders(tenantAccessor.Tenant?.Id);
 27    }
 28}