refactor: rename ScadaLink → ZB.MOM.WW.ScadaBridge (code + projects + namespaces)
Solution + 23 src projects + 26 test projects renamed; folders, csproj, namespaces, and ScadaLinkDbContext/ScadaBridgeDbContext class updated. ActorSystem "scadalink" → "scadabridge", Akka seed-node URLs migrated. SQL roles/logins, LDAP domains, CLI command name, and CLI config dir (~/.scadalink → ~/.scadabridge) also renamed. Build green; 5 Host.Tests fail awaiting SQL login rename in next commit. Pre-existing StaleTagMonitor timing flakes unchanged. Rename script committed at tools/rename-to-scadabridge.sh.
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
using Bunit;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using ZB.MOM.WW.ScadaBridge.CentralUI.Components.Shared;
|
||||
|
||||
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Shared;
|
||||
|
||||
/// <summary>
|
||||
/// Component tests for the OnTrue/WhileTrue mode selector that
|
||||
/// <see cref="ScriptTriggerEditor"/> exposes for Conditional and Expression
|
||||
/// triggers.
|
||||
/// </summary>
|
||||
public class ScriptTriggerEditorTests : BunitContext
|
||||
{
|
||||
private const string ConditionalConfig =
|
||||
@"{""attributeName"":""Temp"",""operator"":"">"",""threshold"":50}";
|
||||
|
||||
private const string ConditionalWhileTrueConfig =
|
||||
@"{""attributeName"":""Temp"",""operator"":"">"",""threshold"":50,""mode"":""WhileTrue""}";
|
||||
|
||||
[Fact]
|
||||
public void SelectingWhileTrue_EmitsConfigWithWhileTrueMode()
|
||||
{
|
||||
ScriptTriggerValue? captured = null;
|
||||
var cut = Render<ScriptTriggerEditor>(ps => ps
|
||||
.Add(p => p.TriggerType, "Conditional")
|
||||
.Add(p => p.TriggerConfig, ConditionalConfig)
|
||||
.Add(p => p.Changed,
|
||||
EventCallback.Factory.Create<ScriptTriggerValue>(this, v => captured = v)));
|
||||
|
||||
cut.Find("#script-trigger-mode").Change("WhileTrue");
|
||||
|
||||
Assert.NotNull(captured);
|
||||
Assert.Contains("\"mode\":\"WhileTrue\"", captured!.Config);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ModeSelector_DefaultsToOnTrue_WhenConfigHasNoMode()
|
||||
{
|
||||
ScriptTriggerValue? captured = null;
|
||||
var cut = Render<ScriptTriggerEditor>(ps => ps
|
||||
.Add(p => p.TriggerType, "Conditional")
|
||||
.Add(p => p.TriggerConfig, ConditionalConfig)
|
||||
.Add(p => p.Changed,
|
||||
EventCallback.Factory.Create<ScriptTriggerValue>(this, v => captured = v)));
|
||||
|
||||
// Change the threshold to force an emit without touching the mode.
|
||||
cut.Find("input[type=number]").Input("75");
|
||||
|
||||
Assert.NotNull(captured);
|
||||
Assert.Contains("\"mode\":\"OnTrue\"", captured!.Config);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LoadedWhileTrueMode_IsRetainedAcrossAnUnrelatedEdit()
|
||||
{
|
||||
ScriptTriggerValue? captured = null;
|
||||
var cut = Render<ScriptTriggerEditor>(ps => ps
|
||||
.Add(p => p.TriggerType, "Conditional")
|
||||
.Add(p => p.TriggerConfig, ConditionalWhileTrueConfig)
|
||||
.Add(p => p.Changed,
|
||||
EventCallback.Factory.Create<ScriptTriggerValue>(this, v => captured = v)));
|
||||
|
||||
// Editing the threshold must not silently drop the loaded WhileTrue mode.
|
||||
cut.Find("input[type=number]").Input("75");
|
||||
|
||||
Assert.NotNull(captured);
|
||||
Assert.Contains("\"mode\":\"WhileTrue\"", captured!.Config);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user