< Summary

Information
Class: Elsa.Workflows.Activities.Flowchart.Activities.FlowFork
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Activities/Flowchart/Activities/FlowFork.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 38
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%
get_Branches()100%11100%
ExecuteAsync()100%44100%

File(s)

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

#LineLine coverage
 1using System.Runtime.CompilerServices;
 2using Elsa.Extensions;
 3using Elsa.Workflows.Attributes;
 4using Elsa.Workflows.Models;
 5using Elsa.Workflows.UIHints;
 6using JetBrains.Annotations;
 7
 8namespace Elsa.Workflows.Activities.Flowchart.Activities;
 9
 10/// <summary>
 11/// Branch execution into multiple branches that will be executed in parallel.
 12/// </summary>
 13[Activity("Elsa", "Branching", "Branch execution into multiple branches that will be executed in parallel.", DisplayName
 14[PublicAPI]
 15public class FlowFork : Activity
 16{
 17    /// <inheritdoc />
 3318    public FlowFork([CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(source, line)
 19    {
 3320    }
 21
 22    /// <summary>
 23    /// A list of expected outcomes to handle.
 24    /// </summary>
 25    [Input(
 26        Description = "A list of expected outcomes to handle.",
 27        UIHint = InputUIHints.DynamicOutcomes
 28    )]
 10529    public Input<ICollection<string>> Branches { get; set; } = null!;
 30
 31    /// <inheritdoc />
 32    protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
 33    {
 1634        var outcomes = Branches.GetOrDefault(context)?.ToArray() ?? ["Done"];
 35
 1636        await context.CompleteActivityWithOutcomesAsync(outcomes);
 1637    }
 38}