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.
49 lines
2.4 KiB
C#
49 lines
2.4 KiB
C#
using ZB.MOM.WW.ScadaBridge.Commons.Messages.DataConnection;
|
|
using ZB.MOM.WW.ScadaBridge.Commons.Types.Alarms;
|
|
using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.Commons.Tests.Messages;
|
|
|
|
public class NativeAlarmMessagesTests
|
|
{
|
|
/// <summary>Verifies that subscribe alarms request: carries source and filter.</summary>
|
|
[Fact]
|
|
public void SubscribeAlarmsRequest_CarriesSourceAndFilter()
|
|
{
|
|
var r = new SubscribeAlarmsRequest("c1", "inst", "PlantOpcUa", "ns=2;s=Tank01", null, DateTimeOffset.UnixEpoch);
|
|
Assert.Equal("ns=2;s=Tank01", r.SourceReference);
|
|
Assert.Null(r.ConditionFilter);
|
|
}
|
|
|
|
/// <summary>Verifies that native alarm transition update: wraps transition.</summary>
|
|
[Fact]
|
|
public void NativeAlarmTransitionUpdate_WrapsTransition()
|
|
{
|
|
var t = new NativeAlarmTransition("Tank01.Hi", "Tank01", "x", AlarmTransitionKind.Raise,
|
|
new AlarmConditionState(true, false, null, AlarmShelveState.Unshelved, false, 500),
|
|
"", "", "", "", "", null, DateTimeOffset.UnixEpoch, "", "");
|
|
var u = new NativeAlarmTransitionUpdate("PlantOpcUa", t);
|
|
Assert.Equal("PlantOpcUa", u.ConnectionName);
|
|
Assert.Equal("Tank01", u.Transition.SourceObjectReference);
|
|
}
|
|
|
|
/// <summary>Verifies that native alarm transition, when ack time, is an additive trailing parameter.</summary>
|
|
[Fact]
|
|
public void NativeAlarmTransition_AckTime_IsAnAdditiveTrailingParameter()
|
|
{
|
|
// MES alarm-status API §6.4. The 14-argument positional form (every pre-existing
|
|
// call site) must still compile and report no ack time; the 15th argument is the
|
|
// only way to set one.
|
|
var withoutAck = new NativeAlarmTransition("Tank01.Hi", "Tank01", "x", AlarmTransitionKind.Raise,
|
|
new AlarmConditionState(true, false, null, AlarmShelveState.Unshelved, false, 500),
|
|
"", "", "", "", "", null, DateTimeOffset.UnixEpoch, "", "");
|
|
Assert.Null(withoutAck.AckTime);
|
|
|
|
var ackedAt = DateTimeOffset.UnixEpoch.AddMinutes(5);
|
|
var withAck = new NativeAlarmTransition("Tank01.Hi", "Tank01", "x", AlarmTransitionKind.Acknowledge,
|
|
new AlarmConditionState(true, true, null, AlarmShelveState.Unshelved, false, 500),
|
|
"", "", "", "", "", null, DateTimeOffset.UnixEpoch, "", "", ackedAt);
|
|
Assert.Equal(ackedAt, withAck.AckTime);
|
|
}
|
|
}
|