< Summary

Information
Class: Elsa.Workflows.Expressions.VariableExpressionHandler
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Expressions/VariableExpressionHandler.cs
Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 19
Line coverage: 100%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
EvaluateAsync(...)50%22100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Expressions/VariableExpressionHandler.cs

#LineLine coverage
 1using Elsa.Expressions.Contracts;
 2using Elsa.Expressions.Models;
 3using Elsa.Workflows.Memory;
 4
 5namespace Elsa.Workflows.Expressions;
 6
 7/// <summary>
 8/// Handles Variable expressions.
 9/// </summary>
 10public class VariableExpressionHandler : IExpressionHandler
 11{
 12    /// <inheritdoc />
 13    public ValueTask<object?> EvaluateAsync(Expression expression, Type returnType, ExpressionExecutionContext context, 
 14    {
 215        var variable = expression.Value as Variable;
 216        var value = variable?.Get(context);
 217        return ValueTask.FromResult(value);
 18    }
 19}