513fa1aa16
Comment/XML-doc changes only: - add summaries to ~10k test methods, fixtures, fakes and helpers (+ <param> on theories, <returns> on async Task methods, <inheritdoc/> on interface implementations the checker can resolve) - strip ~2.6k project-tracking references (WP*, P*-*, row-NN, Task N, #NN, Component-0NN) from comments, keeping the explanatory text; reword false positives in comments only - real docs on fakes implementing BCL/library interfaces (IDisposable, ILogger, IOptionsMonitor, IAsyncLifetime) - reword the last 5 src/ false positives (CWE-1236, failures-1, year-0001, M365) Only non-comment edits: four one-line nested classes split across lines so members can carry docs. Build 0 errors / 0 warnings.
54 lines
2.4 KiB
C#
54 lines
2.4 KiB
C#
using ZB.MOM.WW.ScadaBridge.CLI.Commands;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.CLI.Tests.Commands;
|
|
|
|
/// <summary>
|
|
/// <c>--trigger-kind</c> is written into the trigger-config JSON by
|
|
/// <see cref="ZB.MOM.WW.ScadaBridge.CLI.TriggerConfigJson.InjectAnalysisKind"/>, which
|
|
/// returns null (dropping the kind) when no <c>--trigger-config</c> is supplied. Passing
|
|
/// <c>--trigger-kind</c> without <c>--trigger-config</c> was therefore a silent no-op.
|
|
/// The CLI now detects that combination (<see cref="TemplateCommands.TriggerKindWillBeIgnored"/>)
|
|
/// and warns the user (warn-and-continue, not a hard error). These tests pin the predicate.
|
|
/// </summary>
|
|
public class TemplateTriggerKindIgnoredTests
|
|
{
|
|
/// <summary>Verifies that a trigger kind supplied without a trigger config is reported as ignored.</summary>
|
|
[Fact]
|
|
public void KindWithoutConfig_WillBeIgnored()
|
|
{
|
|
Assert.True(TemplateCommands.TriggerKindWillBeIgnored(triggerConfig: null, triggerKind: "strict"));
|
|
}
|
|
|
|
/// <summary>Verifies that a trigger kind supplied with a blank trigger config is reported as ignored.</summary>
|
|
[Fact]
|
|
public void KindWithBlankConfig_WillBeIgnored()
|
|
{
|
|
Assert.True(TemplateCommands.TriggerKindWillBeIgnored(triggerConfig: " ", triggerKind: "strict"));
|
|
}
|
|
|
|
/// <summary>Verifies that a trigger kind supplied with a trigger config is not reported as ignored.</summary>
|
|
[Fact]
|
|
public void KindWithConfig_NotIgnored()
|
|
{
|
|
Assert.False(TemplateCommands.TriggerKindWillBeIgnored(
|
|
triggerConfig: "{\"expression\":\"x > 0\"}", triggerKind: "strict"));
|
|
}
|
|
|
|
/// <summary>Verifies that omitting the trigger kind is not reported as ignored.</summary>
|
|
[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: " "));
|
|
}
|
|
|
|
/// <summary>Verifies that a trigger config supplied without a trigger kind is not reported as ignored.</summary>
|
|
[Fact]
|
|
public void NoKindWithConfig_NotIgnored()
|
|
{
|
|
Assert.False(TemplateCommands.TriggerKindWillBeIgnored(
|
|
triggerConfig: "{\"expression\":\"x > 0\"}", triggerKind: null));
|
|
}
|
|
}
|