< Summary

Information
Class: Elsa.Expressions.CSharp.Models.ExecutionContextProxy
Assembly: Elsa.Expressions.CSharp
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.CSharp/Models/ExecutionContextProxy.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 8
Coverable lines: 8
Total lines: 46
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_ExpressionExecutionContext()100%210%
.ctor(...)100%210%
GetVariable(...)100%210%
GetVariable(...)100%210%
SetVariable(...)100%210%
GetInput(...)100%210%

File(s)

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

#LineLine coverage
 1using Elsa.Expressions.Helpers;
 2using Elsa.Expressions.Models;
 3using Elsa.Extensions;
 4using JetBrains.Annotations;
 5
 6namespace Elsa.Expressions.CSharp.Models;
 7
 8/// <summary>
 9/// Provides access to the current execution context.
 10/// </summary>
 11[UsedImplicitly]
 12public partial class ExecutionContextProxy
 13{
 14    /// <summary>
 15    /// Gets the current execution context.
 16    /// </summary>
 017    public ExpressionExecutionContext ExpressionExecutionContext { get; }
 18
 19    /// <summary>
 20    /// Initializes a new instance of the <see cref="ExecutionContextProxy"/> class.
 21    /// </summary>
 022    public ExecutionContextProxy(ExpressionExecutionContext expressionExecutionContext)
 23    {
 024        ExpressionExecutionContext = expressionExecutionContext;
 025    }
 26
 27    /// <summary>
 28    /// Gets the value of the specified variable.
 29    /// </summary>
 030    public T? GetVariable<T>(string name) => ExpressionExecutionContext.GetVariableInScope(name).ConvertTo<T>();
 31
 32    /// <summary>
 33    /// Gets the value of the specified variable.
 34    /// </summary>
 035    public object? GetVariable(string name) => ExpressionExecutionContext.GetVariableInScope(name);
 36
 37    /// <summary>
 38    /// Sets the value of the specified variable.
 39    /// </summary>
 040    public void SetVariable(string name, object? value) => ExpressionExecutionContext.SetVariable(name, value);
 41
 42    /// <summary>
 43    /// Gets the value of the specified variable.
 44    /// </summary>
 045    public T? GetInput<T>(string name) => ExpressionExecutionContext.GetInput<T>(name);
 46}