< Summary

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

File(s)

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

#LineLine coverage
 1using Elsa.Expressions.Contracts;
 2using Elsa.Expressions.Models;
 3
 4namespace Elsa.Expressions.Services;
 5
 6/// <inheritdoc />
 3277public class ExpressionEvaluator(IExpressionDescriptorRegistry registry, IServiceProvider serviceProvider) : IExpression
 8{
 9    /// <inheritdoc />
 10    public async ValueTask<T?> EvaluateAsync<T>(Expression expression, ExpressionExecutionContext context, ExpressionEva
 11    {
 812        return (T?)await EvaluateAsync(expression, typeof(T), context, options);
 613    }
 14
 15    /// <inheritdoc />
 16    public async ValueTask<object?> EvaluateAsync(Expression expression, Type returnType, ExpressionExecutionContext con
 17    {
 157718        var expressionType = expression.Type;
 157719        var expressionDescriptor = registry.Find(expressionType);
 20
 157721        if (expressionDescriptor == null)
 122            throw new($"Could not find a descriptor for expression type \"{expressionType}\".");
 23
 157624        var handler = expressionDescriptor.HandlerFactory(serviceProvider);
 157625        options ??= new();
 157626        return await handler.EvaluateAsync(expression, returnType, context, options);
 157527    }
 28}