< Summary

Information
Class: Elsa.Workflows.Behaviors.ScheduledChildCallbackBehavior
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Behaviors/ScheduledChildCallbackBehavior.cs
Line coverage
100%
Covered lines: 17
Uncovered lines: 0
Coverable lines: 17
Total lines: 40
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
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%
OnActivityCompletedAsync()100%44100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Behaviors/ScheduledChildCallbackBehavior.cs

#LineLine coverage
 1using Elsa.Mediator.Contracts;
 2using Elsa.Workflows.Notifications;
 3using JetBrains.Annotations;
 4using ActivityCompleted = Elsa.Workflows.Signals.ActivityCompleted;
 5
 6namespace Elsa.Workflows.Behaviors;
 7
 8/// <summary>
 9/// Implements a behavior that invokes "child completed" callbacks on parent activities.
 10/// </summary>
 11[UsedImplicitly]
 12public class ScheduledChildCallbackBehavior : Behavior
 13{
 14    /// <inheritdoc />
 1297215    public ScheduledChildCallbackBehavior(IActivity owner) : base(owner)
 16    {
 1297217        OnSignalReceived<ActivityCompleted>(OnActivityCompletedAsync);
 1297218    }
 19
 20    private async ValueTask OnActivityCompletedAsync(ActivityCompleted signal, SignalContext context)
 21    {
 1217122        var activityExecutionContext = context.ReceiverActivityExecutionContext;
 1217123        var childActivityExecutionContext = context.SenderActivityExecutionContext;
 1217124        var childActivityNode = childActivityExecutionContext.ActivityNode;
 1217125        var callbackEntry = activityExecutionContext.WorkflowExecutionContext.PopCompletionCallback(activityExecutionCon
 26
 1217127        if (callbackEntry?.CompletionCallback != null)
 28        {
 253929            var completedContext = new ActivityCompletedContext(activityExecutionContext, childActivityExecutionContext,
 253930            var tag = callbackEntry.Tag;
 253931            completedContext.TargetContext.Tag = tag;
 32
 253933            var mediator = activityExecutionContext.GetRequiredService<IMediator>();
 253934            var invokingActivityCallbackNotification = new Notifications.InvokingActivityCallback(activityExecutionConte
 253935            await mediator.SendAsync(invokingActivityCallbackNotification, context.CancellationToken);
 36
 253937            await callbackEntry.CompletionCallback(completedContext);
 253938        }
 1217139    }
 40}