< Summary

Information
Class: Elsa.Expressions.CSharp.Expressions.CSharpExpressionHandler
Assembly: Elsa.Expressions.CSharp
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.CSharp/Expressions/CSharpExpressionHandler.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 6
Coverable lines: 6
Total lines: 29
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
EvaluateAsync()0%620%

File(s)

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

#LineLine coverage
 1using Elsa.Expressions.CSharp.Contracts;
 2using Elsa.Expressions.Contracts;
 3using Elsa.Expressions.Helpers;
 4using Elsa.Expressions.Models;
 5
 6namespace Elsa.Expressions.CSharp.Expressions;
 7
 8/// <summary>
 9/// Evaluates C# expressions.
 10/// </summary>
 11public class CSharpExpressionHandler : IExpressionHandler
 12{
 13    private readonly ICSharpEvaluator _cSharpEvaluator;
 14
 15    /// <summary>
 16    /// Initializes a new instance of the <see cref="CSharpExpressionHandler"/> class.
 17    /// </summary>
 018    public CSharpExpressionHandler(ICSharpEvaluator cSharpEvaluator)
 19    {
 020        _cSharpEvaluator = cSharpEvaluator;
 021    }
 22
 23    /// <inheritdoc />
 24    public async ValueTask<object?> EvaluateAsync(Expression expression, Type returnType, ExpressionExecutionContext con
 25    {
 026        var script = expression.Value.ConvertTo<string>() ?? "";
 027        return await _cSharpEvaluator.EvaluateAsync(script, returnType, context, options);
 028    }
 29}