feat(scripts): add typed Parameters.Get<T>() helpers for script API
Replace raw dictionary casting with ScriptParameters wrapper that provides Get<T>, Get<T?>, Get<T[]>, and Get<List<T>> with clear error messages, numeric conversion, and JsonElement support for Inbound API parameters.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using ScadaLink.Commons.Types;
|
||||
using ScadaLink.SiteRuntime.Scripts;
|
||||
|
||||
namespace ScadaLink.SiteRuntime.Tests.Scripts;
|
||||
@@ -236,7 +237,7 @@ public class SandboxTests
|
||||
var globals = new ScriptGlobals
|
||||
{
|
||||
Instance = null!,
|
||||
Parameters = new Dictionary<string, object?>(),
|
||||
Parameters = new ScriptParameters(),
|
||||
CancellationToken = cts.Token
|
||||
};
|
||||
|
||||
@@ -266,7 +267,7 @@ public class SandboxTests
|
||||
var globals = new ScriptGlobals
|
||||
{
|
||||
Instance = null!,
|
||||
Parameters = new Dictionary<string, object?>(),
|
||||
Parameters = new ScriptParameters(),
|
||||
CancellationToken = cts.Token
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user