< Summary

Information
Class: Elsa.Expressions.CSharp.Notifications.EvaluatingCSharp
Assembly: Elsa.Expressions.CSharp
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.CSharp/Notifications/EvaluatingCSharp.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 7
Coverable lines: 7
Total lines: 40
Line coverage: 0%
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
get_Options()100%210%
ConfigureScriptOptions(...)100%210%
AppendScript(...)100%210%
get_ScriptOptions()100%210%
get_Script()100%210%

File(s)

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

#LineLine coverage
 1using Elsa.Expressions.Models;
 2using Elsa.Mediator.Contracts;
 3using Microsoft.CodeAnalysis.Scripting;
 4
 5namespace Elsa.Expressions.CSharp.Notifications;
 6
 7/// <summary>
 8/// This notification is published every time a C# expression is about to be evaluated.
 9/// It gives subscribers a chance to configure the <see cref="ScriptOptions"/> with additional functions and variables.
 10/// </summary>
 011public record EvaluatingCSharp(ExpressionEvaluatorOptions Options, Script Script, ScriptOptions ScriptOptions, Expressio
 12{
 13    /// <summary>
 14    /// Configures the <see cref="ScriptOptions"/> with additional functions and variables.
 15    /// </summary>
 16    public EvaluatingCSharp ConfigureScriptOptions(Func<ScriptOptions, ScriptOptions> scriptOptions)
 17    {
 018        ScriptOptions = scriptOptions(ScriptOptions);
 019        return this;
 20    }
 21
 22    /// <summary>
 23    /// Appends the specified script to the current script.
 24    /// </summary>
 25    public EvaluatingCSharp AppendScript(string script)
 26    {
 027        Script = Script.ContinueWith(script, ScriptOptions);
 028        return this;
 29    }
 30
 31    /// <summary>
 32    /// The <see cref="ScriptOptions"/> that will be used to evaluate the expression.
 33    /// </summary>
 034    public ScriptOptions ScriptOptions { get; set; } = ScriptOptions;
 35
 36    /// <summary>
 37    /// The <see cref="ScriptState"/> that will be used to evaluate the expression.
 38    /// </summary>
 039    public Script Script { get; set; } = Script;
 40}