< Summary

Information
Class: Elsa.Alterations.Handlers.AlterationPlanCompletedHandler
Assembly: Elsa.Alterations
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Alterations/Handlers/AlterationPlanCompletedHandler.cs
Line coverage
9%
Covered lines: 1
Uncovered lines: 10
Coverable lines: 11
Total lines: 31
Line coverage: 9%
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%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Alterations/Handlers/AlterationPlanCompletedHandler.cs

#LineLine coverage
 1using Elsa.Alterations.Bookmarks;
 2using Elsa.Alterations.Core.Notifications;
 3using Elsa.Mediator.Contracts;
 4using Elsa.Workflows;
 5using Elsa.Workflows.Helpers;
 6using Elsa.Workflows.Runtime;
 7using JetBrains.Annotations;
 8
 9namespace Elsa.Alterations.Handlers;
 10
 11/// <summary>
 12/// Handles <see cref="AlterationPlanCompleted"/> notifications and triggers any workflows that are waiting for the plan
 13/// </summary>
 14[UsedImplicitly]
 32015public class AlterationPlanCompletedHandler(IBookmarkQueue bookmarkQueue, IStimulusHasher stimulusHasher) : INotificatio
 16{
 17    /// <inheritdoc />
 18    public async Task HandleAsync(AlterationPlanCompleted notification, CancellationToken cancellationToken)
 19    {
 20        // Trigger any workflow instances that are waiting for the plan to complete.
 021        var planId = notification.Plan.Id;
 022        var bookmarkPayload = new AlterationPlanCompletedPayload(planId);
 023        var activityTypeName = ActivityTypeNameHelper.GenerateTypeName<Activities.AlterationPlanCompleted>();
 024        var item = new NewBookmarkQueueItem
 025        {
 026            ActivityTypeName = activityTypeName,
 027            StimulusHash = stimulusHasher.Hash(activityTypeName, bookmarkPayload)
 028        };
 029        await bookmarkQueue.EnqueueAsync(item, cancellationToken);
 030    }
 31}