< Summary

Information
Class: Elsa.Expressions.LiteralExpressionHandler
Assembly: Elsa.Expressions
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions/LiteralExpression.cs
Line coverage
100%
Covered lines: 5
Uncovered lines: 0
Coverable lines: 5
Total lines: 28
Line coverage: 100%
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%11100%
EvaluateAsync(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions/LiteralExpression.cs

#LineLine coverage
 1using Elsa.Expressions.Contracts;
 2using Elsa.Expressions.Helpers;
 3using Elsa.Expressions.Models;
 4using JetBrains.Annotations;
 5
 6namespace Elsa.Expressions;
 7
 8/// <inheritdoc />
 9[UsedImplicitly]
 10public class LiteralExpressionHandler : IExpressionHandler
 11{
 12    private readonly IWellKnownTypeRegistry _wellKnownTypeRegistry;
 13
 14    /// <summary>
 15    /// Constructor.
 16    /// </summary>
 129717    public LiteralExpressionHandler(IWellKnownTypeRegistry wellKnownTypeRegistry)
 18    {
 129719        _wellKnownTypeRegistry = wellKnownTypeRegistry;
 129720    }
 21
 22    /// <inheritdoc />
 23    public ValueTask<object?> EvaluateAsync(Expression expression, Type returnType, ExpressionExecutionContext context, 
 24    {
 129725        var value = expression.Value.ConvertTo(returnType, new ObjectConverterOptions(WellKnownTypeRegistry: _wellKnownT
 129726        return ValueTask.FromResult(value);
 27    }
 28}