< Summary - Kestrun — Combined Coverage

Information
Class: Kestrun.Languages.CsGlobals
Assembly: Kestrun
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Languages/CsGlobals.cs
Tag: Kestrun/Kestrun@9d3a582b2d63930269564a7591aa77ef297cadeb
Line coverage
100%
Covered lines: 23
Uncovered lines: 0
Coverable lines: 23
Total lines: 76
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

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
.ctor(...)100%11100%
.ctor(...)100%11100%
.ctor(...)100%11100%
get_Globals()100%11100%
get_Locals()100%11100%
get_Context()100%11100%

File(s)

/home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Languages/CsGlobals.cs

#LineLine coverage
 1
 2
 3using Kestrun.Hosting;
 4
 5namespace Kestrun.Languages;
 6// ---------------------------------------------------------------------------
 7//  C# delegate builder  –  now takes optional imports / references
 8// ---------------------------------------------------------------------------
 9/// <summary>
 10/// Provides global and local variable dictionaries and context for C# delegate execution.
 11/// </summary>
 12public record CsGlobals
 13{
 14    /// <summary>
 15    /// Initializes a new instance of the <see cref="CsGlobals"/> class with the specified global variables.
 16    /// </summary>
 17    /// <param name="globals">A dictionary containing global variables.</param>
 618    public CsGlobals(IReadOnlyDictionary<string, object?> globals)
 19    {
 620        Globals = globals;
 621        Locals = new Dictionary<string, object?>();
 622        Context = null;
 623    }
 24
 25    /// <summary>
 26    /// Initializes a new instance of the <see cref="CsGlobals"/> class with the specified global variables and context.
 27    /// </summary>
 28    /// <param name="globals">A dictionary containing global variables.</param>
 29    /// <param name="krcontext">The Kestrun execution context.</param>
 630    public CsGlobals(IReadOnlyDictionary<string, object?> globals, KestrunContext krcontext)
 31    {
 632        Globals = globals;
 633        Context = krcontext;
 634        Locals = new Dictionary<string, object?>();
 635    }
 36
 37    /// <summary>
 38    /// Initializes a new instance with the specified global and local variables (no execution context).
 39    /// </summary>
 40    /// <param name="globals">Global variables.</param>
 41    /// <param name="locals">Local variables.</param>
 142    public CsGlobals(IReadOnlyDictionary<string, object?> globals, IReadOnlyDictionary<string, object?> locals)
 43    {
 144        Globals = globals;
 145        Locals = locals;
 146        Context = null;
 147    }
 48
 49    /// <summary>
 50    /// Initializes a new instance of the <see cref="CsGlobals"/> class with the specified global variables, context, an
 51    /// </summary>
 52    /// <param name="globals">A dictionary containing global variables.</param>
 53    /// <param name="krcontext">The Kestrun execution context.</param>
 54    /// <param name="locals">A dictionary containing local variables.</param>
 1355    public CsGlobals(IReadOnlyDictionary<string, object?> globals, KestrunContext krcontext, IReadOnlyDictionary<string,
 56    {
 1357        Globals = globals;
 1358        Context = krcontext;
 1359        Locals = locals;
 1360    }
 61
 62    /// <summary>
 63    /// Gets the dictionary containing global variables for delegate execution.
 64    /// </summary>
 4865    public IReadOnlyDictionary<string, object?> Globals { get; }
 66
 67    /// <summary>
 68    /// Gets the dictionary containing local variables for delegate execution.
 69    /// </summary>
 2370    public IReadOnlyDictionary<string, object?> Locals { get; }
 71
 72    /// <summary>
 73    /// Gets the Kestrun execution context for delegate execution.
 74    /// </summary>
 3275    public KestrunContext? Context { get; }
 76}