using ZB.MOM.WW.ScadaBridge.CLI.Commands;
namespace ZB.MOM.WW.ScadaBridge.CLI.Tests.Commands;
///
/// --trigger-kind is written into the trigger-config JSON by
/// , which
/// returns null (dropping the kind) when no --trigger-config is supplied. Passing
/// --trigger-kind without --trigger-config was therefore a silent no-op.
/// The CLI now detects that combination ()
/// and warns the user (warn-and-continue, not a hard error). These tests pin the predicate.
///
public class TemplateTriggerKindIgnoredTests
{
/// Verifies that a trigger kind supplied without a trigger config is reported as ignored.
[Fact]
public void KindWithoutConfig_WillBeIgnored()
{
Assert.True(TemplateCommands.TriggerKindWillBeIgnored(triggerConfig: null, triggerKind: "strict"));
}
/// Verifies that a trigger kind supplied with a blank trigger config is reported as ignored.
[Fact]
public void KindWithBlankConfig_WillBeIgnored()
{
Assert.True(TemplateCommands.TriggerKindWillBeIgnored(triggerConfig: " ", triggerKind: "strict"));
}
/// Verifies that a trigger kind supplied with a trigger config is not reported as ignored.
[Fact]
public void KindWithConfig_NotIgnored()
{
Assert.False(TemplateCommands.TriggerKindWillBeIgnored(
triggerConfig: "{\"expression\":\"x > 0\"}", triggerKind: "strict"));
}
/// Verifies that omitting the trigger kind is not reported as ignored.
[Fact]
public void NoKind_NotIgnored()
{
// No --trigger-kind at all → nothing to warn about, even without a config.
Assert.False(TemplateCommands.TriggerKindWillBeIgnored(triggerConfig: null, triggerKind: null));
Assert.False(TemplateCommands.TriggerKindWillBeIgnored(triggerConfig: null, triggerKind: " "));
}
/// Verifies that a trigger config supplied without a trigger kind is not reported as ignored.
[Fact]
public void NoKindWithConfig_NotIgnored()
{
Assert.False(TemplateCommands.TriggerKindWillBeIgnored(
triggerConfig: "{\"expression\":\"x > 0\"}", triggerKind: null));
}
}