< Summary

Information
Class: Elsa.Workflows.Activities.Flowchart.Activities.FlowJoin
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Activities/Flowchart/Activities/FlowJoin.cs
Line coverage
93%
Covered lines: 15
Uncovered lines: 1
Coverable lines: 16
Total lines: 58
Line coverage: 93.7%
Branch coverage
90%
Covered branches: 9
Total branches: 10
Branch coverage: 90%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_Mode()100%11100%
ExecuteAsync()100%44100%
CanExecute(...)83.33%6687.5%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Activities/Flowchart/Activities/FlowJoin.cs

#LineLine coverage
 1using System.Runtime.CompilerServices;
 2using Elsa.Workflows.Activities.Flowchart.Contracts;
 3using Elsa.Workflows.Activities.Flowchart.Extensions;
 4using Elsa.Workflows.Activities.Flowchart.Models;
 5using Elsa.Workflows.Attributes;
 6using Elsa.Workflows.Models;
 7using Elsa.Workflows.UIHints;
 8using JetBrains.Annotations;
 9
 10namespace Elsa.Workflows.Activities.Flowchart.Activities;
 11
 12/// <summary>
 13/// Merge multiple branches into a single branch of execution.
 14/// Note that this activity is no longer necessary for either AND or OR merges, because all activities inherit the Join 
 15/// Use this activity if an explicit join step is desired.
 16/// </summary>
 17[Activity("Elsa", "Branching", "Explicitly merge multiple branches into a single branch of execution.", DisplayName = "J
 18[UsedImplicitly]
 19public class FlowJoin : Activity, IJoinNode
 20{
 21    /// <inheritdoc />
 4822    public FlowJoin([CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(source, line)
 23    {
 4824    }
 25
 26    /// <summary>
 27    /// The join mode determines whether this activity should continue as soon as one inbound path comes in (Wait Any), 
 28    /// </summary>
 29    [Input(
 30        Description = "The join mode determines whether this activity should continue as soon as one inbound path comes 
 31        DefaultValue = FlowJoinMode.WaitAny,
 32        UIHint = InputUIHints.DropDown
 33    )]
 20334    public Input<FlowJoinMode> Mode { get; set; } = new(FlowJoinMode.WaitAny);
 35
 36    /// <inheritdoc />
 37    protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
 38    {
 2839        if(!Flowchart.UseTokenFlow)
 1640            if (context.ParentActivityExecutionContext != null)
 1341                await context.ParentActivityExecutionContext.CancelInboundAncestorsAsync(this);
 42
 2843        await context.CompleteActivityAsync();
 2844    }
 45
 46    protected override bool CanExecute(ActivityExecutionContext context)
 47    {
 2248        if(Flowchart.UseTokenFlow)
 949            return true;
 50
 1351        return context.Get(Mode) switch
 1352        {
 553            FlowJoinMode.WaitAny => true,
 854            FlowJoinMode.WaitAll => Flowchart.CanWaitAllProceed(context),
 055            _ => true
 1356        };
 57    }
 58}