feat(GWC-37,WRK-32): refresh live alarm watch lists
This commit is contained in:
@@ -91,6 +91,27 @@ public sealed class AlarmCommandExecutorTests
|
||||
Assert.Equal(ProtocolStatusCode.InvalidRequest, reply.ProtocolStatus.Code);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a live watch-list replacement routes to the alarm handler on the executor thread.</summary>
|
||||
[Fact]
|
||||
public void UpdateAlarmWatchList_WithHandler_RoutesToHandlerAndReturnsOk()
|
||||
{
|
||||
FakeAlarmHandler handler = new FakeAlarmHandler();
|
||||
MxAccessCommandExecutor executor = NewExecutor(handler);
|
||||
var target = new AlarmSubtagTarget { AlarmFullReference = "Galaxy!Area.Tank01.Alarm" };
|
||||
|
||||
MxCommandReply reply = executor.Execute(new StaCommand(
|
||||
SessionId,
|
||||
CorrelationId,
|
||||
new MxCommand
|
||||
{
|
||||
Kind = MxCommandKind.UpdateAlarmWatchList,
|
||||
UpdateAlarmWatchList = new UpdateAlarmWatchListCommand { WatchList = { target } },
|
||||
}));
|
||||
|
||||
Assert.Equal(ProtocolStatusCode.Ok, reply.ProtocolStatus.Code);
|
||||
Assert.Equal(target, Assert.Single(handler.LastWatchList!));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that acknowledge routes native status into hresult and payload.</summary>
|
||||
[Fact]
|
||||
public void AcknowledgeAlarm_WithHandler_RoutesNativeStatusIntoHresultAndPayload()
|
||||
@@ -447,6 +468,15 @@ public sealed class AlarmCommandExecutorTests
|
||||
LastSessionId = sessionId;
|
||||
}
|
||||
|
||||
/// <summary>Gets the most recent replacement watch list.</summary>
|
||||
public IReadOnlyList<AlarmSubtagTarget>? LastWatchList { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void UpdateWatchList(IReadOnlyList<AlarmSubtagTarget> watchList)
|
||||
{
|
||||
LastWatchList = watchList;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Unsubscribe()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user