< Summary

Information
Class: Elsa.Workflows.Activities.Flowchart.Extensions.RunWorkflowOptionsExtensions
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Activities/Flowchart/Extensions/RunWorkflowOptionsExtensions.cs
Line coverage
60%
Covered lines: 3
Uncovered lines: 2
Coverable lines: 5
Total lines: 39
Line coverage: 60%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
WithTokenBasedFlowchart(...)100%210%
WithCounterBasedFlowchart(...)100%210%
WithFlowchartExecutionMode(...)100%22100%

File(s)

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

#LineLine coverage
 1using Elsa.Workflows.Activities.Flowchart.Models;
 2using Elsa.Workflows.Options;
 3
 4namespace Elsa.Workflows.Activities.Flowchart.Extensions;
 5
 6/// <summary>
 7/// Extension methods for <see cref="RunWorkflowOptions"/> to configure flowchart execution mode.
 8/// </summary>
 9public static class RunWorkflowOptionsExtensions
 10{
 11    extension(RunWorkflowOptions options)
 12    {
 13        /// <summary>
 14        /// Sets the flowchart execution mode to token-based.
 15        /// </summary>
 16        public RunWorkflowOptions WithTokenBasedFlowchart()
 17        {
 018            return options.WithFlowchartExecutionMode(FlowchartExecutionMode.TokenBased);
 19        }
 20
 21        /// <summary>
 22        /// Sets the flowchart execution mode to counter-based (legacy mode).
 23        /// </summary>
 24        public RunWorkflowOptions WithCounterBasedFlowchart()
 25        {
 026            return options.WithFlowchartExecutionMode(FlowchartExecutionMode.CounterBased);
 27        }
 28
 29        /// <summary>
 30        /// Sets the flowchart execution mode.
 31        /// </summary>
 32        public RunWorkflowOptions WithFlowchartExecutionMode(FlowchartExecutionMode mode)
 33        {
 6034            options.Properties ??= new Dictionary<string, object>();
 6035            options.Properties[Activities.Flowchart.ExecutionModePropertyKey] = mode;
 6036            return options;
 37        }
 38    }
 39}