< Summary

Information
Class: Elsa.Workflows.Runtime.Middleware.Workflows.CancelWorkflowMiddleware
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Middleware/Workflows/CancelWorkflowMiddleware.cs
Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 16
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%
InvokeAsync(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Middleware/Workflows/CancelWorkflowMiddleware.cs

#LineLine coverage
 1using Elsa.Workflows.Pipelines.WorkflowExecution;
 2
 3namespace Elsa.Workflows.Runtime.Middleware.Workflows;
 4
 5/// <summary>
 6/// Represents a middleware that cancels the workflow.
 7/// </summary>
 58public class CancelWorkflowMiddleware(WorkflowMiddlewareDelegate next) : WorkflowExecutionMiddleware(next)
 9{
 10    /// <inheritdoc />
 11    public override ValueTask InvokeAsync(WorkflowExecutionContext context)
 12    {
 513        context.Cancel();
 514        return ValueTask.CompletedTask;
 15    }
 16}