< Summary

Information
Class: Elsa.Workflows.Activities.Flowchart.Models.FlowSwitchCase
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Activities/Flowchart/Models/FlowSwitchCase.cs
Line coverage
50%
Covered lines: 8
Uncovered lines: 8
Coverable lines: 16
Total lines: 60
Line coverage: 50%
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%210%
.ctor(...)100%11100%
.ctor(...)100%210%
.ctor(...)100%210%
.ctor(...)100%210%
.ctor(...)100%11100%
get_Label()100%11100%
get_Condition()100%11100%

File(s)

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

#LineLine coverage
 1using System.Text.Json.Serialization;
 2using Elsa.Expressions.Models;
 3using Elsa.Workflows.Activities.Flowchart.Activities;
 4
 5namespace Elsa.Workflows.Activities.Flowchart.Models;
 6
 7/// <summary>
 8/// Represents an individual case of the <see cref="FlowSwitch"/> activity.
 9/// </summary>
 10public class FlowSwitchCase
 11{
 12    /// <summary>
 13    /// Initializes a new instance of the <see cref="FlowSwitchCase"/> class.
 14    /// </summary>
 15    [JsonConstructor]
 016    public FlowSwitchCase()
 17    {
 018    }
 19
 20    /// <summary>
 21    /// Initializes a new instance of the <see cref="FlowSwitchCase"/> class.
 22    /// </summary>
 23    /// <param name="label">The label of the case.</param>
 24    /// <param name="condition">The condition of the case.</param>
 1025    public FlowSwitchCase(string label, Expression condition)
 26    {
 1027        Label = label;
 1028        Condition = condition;
 1029    }
 30
 31    /// <inheritdoc />
 032    public FlowSwitchCase(string label, Func<ExpressionExecutionContext, ValueTask<bool>> condition) : this(label, Expre
 33    {
 034    }
 35
 36    /// <inheritdoc />
 037    public FlowSwitchCase(string label, Func<ValueTask<bool>> condition) : this(label, Expression.DelegateExpression(con
 38    {
 039    }
 40
 41    /// <inheritdoc />
 042    public FlowSwitchCase(string label, Func<ExpressionExecutionContext, bool> condition) : this(label, Expression.Deleg
 43    {
 044    }
 45
 46    /// <inheritdoc />
 847    public FlowSwitchCase(string label, Func<bool> condition) : this(label, Expression.DelegateExpression(condition))
 48    {
 849    }
 50
 51    /// <summary>
 52    /// Gets or sets the label of the case.
 53    /// </summary>
 2254    public string Label { get; set; } = null!;
 55
 56    /// <summary>
 57    /// Gets or sets the condition of the case.
 58    /// </summary>
 3859    public Expression Condition { get; set; } = Expression.LiteralExpression(false);
 60}