< Summary

Information
Class: Elsa.Workflows.Management.Handlers.Notifications.DeleteWorkflowInstances
Assembly: Elsa.Workflows.Management
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Management/Handlers/Notifications/DeleteWorkflowInstances.cs
Line coverage
50%
Covered lines: 6
Uncovered lines: 6
Coverable lines: 12
Total lines: 53
Line coverage: 50%
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%
HandleAsync()100%11100%
HandleAsync()100%210%
HandleAsync()100%210%
HandleAsync()100%210%
DeleteWorkflowInstancesAsync()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Management/Handlers/Notifications/DeleteWorkflowInstances.cs

#LineLine coverage
 1using Elsa.Mediator.Contracts;
 2using Elsa.Workflows.Management.Filters;
 3using Elsa.Workflows.Management.Notifications;
 4using JetBrains.Annotations;
 5
 6namespace Elsa.Workflows.Management.Handlers.Notifications;
 7
 8/// <summary>
 9/// Deletes workflow instances when a workflow definition or version is deleted.
 10/// </summary>
 11[UsedImplicitly]
 12public class DeleteWorkflowInstances :
 13    INotificationHandler<WorkflowDefinitionDeleting>,
 14    INotificationHandler<WorkflowDefinitionVersionDeleting>,
 15    INotificationHandler<WorkflowDefinitionsDeleting>,
 16    INotificationHandler<WorkflowDefinitionVersionsDeleting>
 17{
 18    private readonly IWorkflowInstanceManager _workflowInstanceManager;
 19
 20    /// <summary>
 21    /// Initializes a new instance of the <see cref="DeleteWorkflowInstances"/> class.
 22    /// </summary>
 31923    public DeleteWorkflowInstances(IWorkflowInstanceManager workflowInstanceManager)
 24    {
 31925        _workflowInstanceManager = workflowInstanceManager;
 31926    }
 27
 28    /// <inheritdoc />
 29    public async Task HandleAsync(WorkflowDefinitionDeleting notification, CancellationToken cancellationToken)
 30    {
 431        await DeleteWorkflowInstancesAsync(new WorkflowInstanceFilter { DefinitionId = notification.DefinitionId }, canc
 432    }
 33
 34    /// <inheritdoc />
 35    public async Task HandleAsync(WorkflowDefinitionVersionDeleting notification, CancellationToken cancellationToken)
 36    {
 037        await DeleteWorkflowInstancesAsync(new WorkflowInstanceFilter { DefinitionVersionId = notification.WorkflowDefin
 038    }
 39
 40    /// <inheritdoc />
 41    public async Task HandleAsync(WorkflowDefinitionsDeleting notification, CancellationToken cancellationToken)
 42    {
 043        await DeleteWorkflowInstancesAsync(new WorkflowInstanceFilter { DefinitionIds = notification.DefinitionIds }, ca
 044    }
 45
 46    /// <inheritdoc />
 47    public async Task HandleAsync(WorkflowDefinitionVersionsDeleting notification, CancellationToken cancellationToken)
 48    {
 049        await DeleteWorkflowInstancesAsync(new WorkflowInstanceFilter { Ids = notification.Ids }, cancellationToken);
 050    }
 51
 452    private async Task DeleteWorkflowInstancesAsync(WorkflowInstanceFilter filter, CancellationToken cancellationToken) 
 53}