< Summary - Kestrun — Combined Coverage

Information
Class: Kestrun.SharedState.GlobalStore
Assembly: Kestrun
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/SharedState/GlobalStore.cs
Tag: Kestrun/Kestrun@0d738bf294e6281b936d031e1979d928007495ff
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 68
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 11/14/2025 - 12:29:34 Line coverage: 16.6% (2/12) Total lines: 68 Tag: Kestrun/Kestrun@5e12b09a6838e68e704cd3dc975331b9e680a62612/15/2025 - 18:44:50 Line coverage: 100% (12/12) Total lines: 68 Tag: Kestrun/Kestrun@6b9e56ea2de904fc3597033ef0f9bc7839d5d618

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
Set(...)100%11100%
Contains(...)100%11100%
TryGet(...)100%11100%
Get(...)100%11100%
Snapshot()100%11100%
KeySnapshot()100%11100%
Clear()100%11100%
get_Count()100%11100%
get_Keys()100%11100%
get_Values()100%11100%
Remove(...)100%11100%

File(s)

/home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/SharedState/GlobalStore.cs

#LineLine coverage
 1namespace Kestrun.SharedState;
 2
 3/// <summary>
 4/// Thread‑safe, case‑insensitive global key/value store for reference‑type objects.
 5/// </summary>
 6public static class GlobalStore
 7{
 18    private static readonly SharedState _store = new();
 9
 10    // ── public API ──────────────────────────────────────────────────
 11    /// <summary>Add or overwrite a value (reference‑types only).</summary>
 12    public static bool Set(string name, object? value, bool allowsValueType = false) =>
 31213        _store.Set(name, value, allowsValueType);
 14
 15    /// <summary>
 16    /// Checks if a variable with the specified name exists in the shared state.
 17    /// </summary>
 18    /// <param name="name">The name of the variable to check.</param>
 19    /// <returns> <c>true</c> if the variable exists; otherwise, <c>false</c>.</returns>
 2020    public static bool Contains(string name) => _store.Contains(name);
 21
 22    /// <summary>
 23    /// Strongly‑typed fetch. Returns <c>false</c> if the key is missing
 24    /// or the stored value can’t be cast to <typeparamref name="T"/>.
 25    /// </summary>
 26    public static bool TryGet<T>(string name, out T? value) =>
 1027        _store.TryGet(name, out value);
 28
 29    /// <summary>Untyped fetch; <c>null</c> if absent.</summary>
 30    public static object? Get(string name) =>
 5731        _store.Get(name);
 32    /// <summary>Snapshot of *all* current variables (shallow copy).</summary>
 33    public static IReadOnlyDictionary<string, object?> Snapshot() =>
 6334        _store.Snapshot();
 35
 36    /// <summary>Snapshot of keys only—handy for quick listings.</summary>
 37    public static IReadOnlyCollection<string> KeySnapshot() =>
 238        _store.KeySnapshot();
 39    /// <summary>
 40    /// Clears all entries in the shared state.
 41    /// </summary>
 42    public static void Clear() =>
 10743        _store.Clear();
 44
 45    /// <summary>
 46    /// Gets the number of key/value pairs in the shared state.
 47    /// </summary>
 48    public static int Count =>
 1549        _store.Count;
 50    /// <summary>
 51    /// Gets an enumerable collection of all keys in the shared state.
 52    /// </summary>
 53    public static IEnumerable<string> Keys =>
 254        _store.Keys;
 55    /// <summary>
 56    /// Gets an enumerable collection of all values in the shared state.
 57    /// </summary>
 58    public static IEnumerable<object?> Values =>
 259        _store.Values;
 60
 61    /// <summary>
 62    /// Attempts to remove the value with the specified name from the shared state.
 63    /// </summary>
 64    /// <param name="name">The name of the variable to remove.</param>
 65    /// <returns><c>true</c> if the variable was successfully removed; otherwise, <c>false</c>.</returns>
 66    public static bool Remove(string name) =>
 10567            _store.Remove(name);
 68}