feat(alarms): carry transition Kind on AlarmEventArgs; Galaxy populates it (Phase B WS-1)
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using Shouldly;
|
||||
using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
|
||||
using Xunit;
|
||||
|
||||
namespace ZB.MOM.WW.OtOpcUa.Core.Abstractions.Tests;
|
||||
|
||||
public class AlarmEventArgsTests
|
||||
{
|
||||
private static AlarmEventArgs Make(AlarmTransitionKind? kind = null) =>
|
||||
kind is null
|
||||
? new AlarmEventArgs(new FakeHandle(), "Tank1.Hi", "c1", "LimitAlarm.Hi", "msg", AlarmSeverity.High, DateTime.UnixEpoch)
|
||||
: new AlarmEventArgs(new FakeHandle(), "Tank1.Hi", "c1", "LimitAlarm.Hi", "msg", AlarmSeverity.High, DateTime.UnixEpoch, Kind: kind.Value);
|
||||
|
||||
[Fact]
|
||||
public void Kind_defaults_to_Unspecified_so_existing_callers_compile()
|
||||
=> Make().Kind.ShouldBe(AlarmTransitionKind.Unspecified);
|
||||
|
||||
[Fact]
|
||||
public void Kind_round_trips_when_supplied()
|
||||
=> Make(AlarmTransitionKind.Raise).Kind.ShouldBe(AlarmTransitionKind.Raise);
|
||||
|
||||
private sealed class FakeHandle : IAlarmSubscriptionHandle { public string DiagnosticId => "t"; }
|
||||
}
|
||||
Reference in New Issue
Block a user