< Summary

Information
Class: Elsa.Workflows.Behaviors.AutoCompleteBehavior
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Behaviors/AutoCompleteBehavior.cs
Line coverage
83%
Covered lines: 5
Uncovered lines: 1
Coverable lines: 6
Total lines: 25
Line coverage: 83.3%
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%
ExecuteAsync()50%2266.66%

File(s)

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

#LineLine coverage
 1using JetBrains.Annotations;
 2
 3namespace Elsa.Workflows.Behaviors;
 4
 5/// <summary>
 6/// Automatically completes the currently executing activity.
 7/// </summary>
 8[UsedImplicitly]
 9public class AutoCompleteBehavior : Behavior
 10{
 11    /// <inheritdoc />
 253712    public AutoCompleteBehavior(IActivity owner) : base(owner)
 13    {
 253714    }
 15
 16    /// <inheritdoc />
 17    protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
 18    {
 19        // If the activity created any bookmarks, do not complete.
 64420        if (context.NewBookmarks.Any(x => x.ActivityId == context.Activity.Id))
 021            return;
 22
 64423        await context.CompleteActivityAsync();
 64424    }
 25}