< Summary

Information
Class: Elsa.Alterations.Core.Services.AlteredWorkflowDispatcher
Assembly: Elsa.Alterations.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Alterations.Core/Services/AlteredWorkflowDispatcher.cs
Line coverage
37%
Covered lines: 3
Uncovered lines: 5
Coverable lines: 8
Total lines: 34
Line coverage: 37.5%
Branch coverage
0%
Covered branches: 0
Total branches: 4
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%
DispatchAsync()100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Alterations.Core/Services/AlteredWorkflowDispatcher.cs

#LineLine coverage
 1using Elsa.Alterations.Core.Contracts;
 2using Elsa.Alterations.Core.Results;
 3using Elsa.Workflows.Runtime;
 4using Elsa.Workflows.Runtime.Contracts;
 5using Elsa.Workflows.Runtime.Requests;
 6
 7namespace Elsa.Alterations.Core.Services;
 8
 9/// <inheritdoc />
 10public class AlteredWorkflowDispatcher : IAlteredWorkflowDispatcher
 11{
 12    private readonly IWorkflowDispatcher _workflowDispatcher;
 13
 14    /// <summary>
 15    /// Initializes a new instance of the <see cref="AlteredWorkflowDispatcher"/> class.
 16    /// </summary>
 117    public AlteredWorkflowDispatcher(IWorkflowDispatcher workflowDispatcher)
 18    {
 119        _workflowDispatcher = workflowDispatcher;
 120    }
 21
 22    /// <inheritdoc />
 23    public async Task DispatchAsync(IEnumerable<RunAlterationsResult> results, CancellationToken cancellationToken = def
 24    {
 025        foreach (var result in results.Where(x => x is { IsSuccessful: true, WorkflowHasScheduledWork: true }))
 026            await DispatchAsync(result, cancellationToken);
 027    }
 28
 29    /// <inheritdoc />
 30    public async Task DispatchAsync(RunAlterationsResult result, CancellationToken cancellationToken = default)
 31    {
 032        await _workflowDispatcher.DispatchAsync(new DispatchWorkflowInstanceRequest(result.WorkflowInstanceId), cancella
 033    }
 34}