< Summary

Information
Class: Elsa.Workflows.Api.Endpoints.WorkflowInstances.Delete.Delete
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowInstances/Delete/Endpoint.cs
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 26
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%
Configure()100%11100%
HandleAsync()100%22100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowInstances/Delete/Endpoint.cs

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Workflows.Runtime;
 3using JetBrains.Annotations;
 4
 5namespace Elsa.Workflows.Api.Endpoints.WorkflowInstances.Delete;
 6
 7[PublicAPI]
 58internal class Delete(IWorkflowRuntime workflowRuntime) : ElsaEndpoint<Request>
 9{
 10    public override void Configure()
 11    {
 112        Delete("/workflow-instances/{id}");
 113        ConfigurePermissions("delete:workflow-instances");
 114    }
 15
 16    public override async Task HandleAsync(Request request, CancellationToken cancellationToken)
 17    {
 418        var client = await workflowRuntime.CreateClientAsync(request.Id, cancellationToken);
 419        var deleted = await client.DeleteAsync(cancellationToken);
 20
 421        if (deleted)
 322            await Send.NoContentAsync(cancellationToken);
 23        else
 124            await Send.NotFoundAsync(cancellationToken);
 425    }
 26}