feat(client-cli): add ack/confirm/shelve alarm commands with service layer

Adds ConfirmAlarmAsync and ShelveAlarmAsync to IOpcUaClientService and
OpcUaClientService (mirroring the AcknowledgeAlarmAsync pattern: same
CallMethodAsync/ServiceResultException/StatusCode contract). Adds ShelveKind
enum (OneShot/Timed/Unshelve). Adds three new CLI commands — ack, confirm,
shelve — with hex EventId input and per-command argument validation.
Updates both fakes (CLI + UI) to implement the new interface members and
record calls. Adds 16 unit tests covering argument mapping, invalid-input
CommandException paths, bad-status output, and disconnect-in-finally.
This commit is contained in:
Joseph Doherty
2026-06-11 05:46:25 -04:00
parent a6fed85ac9
commit 1f172e55f7
11 changed files with 819 additions and 1 deletions
@@ -220,11 +220,46 @@ public sealed class FakeOpcUaClientService : IOpcUaClientService
return Task.CompletedTask;
}
/// <summary>Gets the list of (conditionNodeId, eventId, comment) tuples from AcknowledgeAlarmAsync calls.</summary>
public List<(string ConditionNodeId, byte[] EventId, string Comment)> AcknowledgeAlarmCalls { get; } = [];
/// <summary>Gets or sets the status code returned by AcknowledgeAlarmAsync.</summary>
public StatusCode AcknowledgeAlarmResult { get; set; } = StatusCodes.Good;
/// <inheritdoc />
public Task<StatusCode> AcknowledgeAlarmAsync(string conditionNodeId, byte[] eventId, string comment,
CancellationToken ct = default)
{
return Task.FromResult(new StatusCode(StatusCodes.Good));
AcknowledgeAlarmCalls.Add((conditionNodeId, eventId, comment));
return Task.FromResult(AcknowledgeAlarmResult);
}
/// <summary>Gets the list of (conditionNodeId, eventId, comment) tuples from ConfirmAlarmAsync calls.</summary>
public List<(string ConditionNodeId, byte[] EventId, string Comment)> ConfirmAlarmCalls { get; } = [];
/// <summary>Gets or sets the status code returned by ConfirmAlarmAsync.</summary>
public StatusCode ConfirmAlarmResult { get; set; } = StatusCodes.Good;
/// <inheritdoc />
public Task<StatusCode> ConfirmAlarmAsync(string conditionNodeId, byte[] eventId, string comment,
CancellationToken ct = default)
{
ConfirmAlarmCalls.Add((conditionNodeId, eventId, comment));
return Task.FromResult(ConfirmAlarmResult);
}
/// <summary>Gets the list of (conditionNodeId, kind, durationSeconds) tuples from ShelveAlarmAsync calls.</summary>
public List<(string ConditionNodeId, ShelveKind Kind, double DurationSeconds)> ShelveAlarmCalls { get; } = [];
/// <summary>Gets or sets the status code returned by ShelveAlarmAsync.</summary>
public StatusCode ShelveAlarmResult { get; set; } = StatusCodes.Good;
/// <inheritdoc />
public Task<StatusCode> ShelveAlarmAsync(string conditionNodeId, ShelveKind kind, double shelvingTimeSeconds = 0,
CancellationToken ct = default)
{
ShelveAlarmCalls.Add((conditionNodeId, kind, shelvingTimeSeconds));
return Task.FromResult(ShelveAlarmResult);
}
/// <inheritdoc />