test(client-ui): track Shelve/Confirm calls + exceptions in FakeOpcUaClientService
This commit is contained in:
@@ -265,21 +265,39 @@ public sealed class FakeOpcUaClientService : IOpcUaClientService
|
|||||||
|
|
||||||
/// <summary>Gets or sets the status code returned by confirmation operations in UI tests.</summary>
|
/// <summary>Gets or sets the status code returned by confirmation operations in UI tests.</summary>
|
||||||
public StatusCode ConfirmResult { get; set; } = StatusCodes.Good;
|
public StatusCode ConfirmResult { get; set; } = StatusCodes.Good;
|
||||||
|
/// <summary>Gets or sets the exception thrown to simulate alarm confirmation failures in the UI.</summary>
|
||||||
|
public Exception? ConfirmException { get; set; }
|
||||||
|
/// <summary>Gets the number of times ConfirmAlarmAsync has been called.</summary>
|
||||||
|
public int ConfirmCallCount { get; private set; }
|
||||||
|
/// <summary>Gets the (conditionNodeId, eventId, comment) of the last ConfirmAlarmAsync call.</summary>
|
||||||
|
public (string ConditionNodeId, byte[] EventId, string Comment)? LastConfirmCall { get; private set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task<StatusCode> ConfirmAlarmAsync(string conditionNodeId, byte[] eventId, string comment,
|
public Task<StatusCode> ConfirmAlarmAsync(string conditionNodeId, byte[] eventId, string comment,
|
||||||
CancellationToken ct = default)
|
CancellationToken ct = default)
|
||||||
{
|
{
|
||||||
|
ConfirmCallCount++;
|
||||||
|
LastConfirmCall = (conditionNodeId, eventId, comment);
|
||||||
|
if (ConfirmException != null) throw ConfirmException;
|
||||||
return Task.FromResult(ConfirmResult);
|
return Task.FromResult(ConfirmResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Gets or sets the status code returned by shelve operations in UI tests.</summary>
|
/// <summary>Gets or sets the status code returned by shelve operations in UI tests.</summary>
|
||||||
public StatusCode ShelveResult { get; set; } = StatusCodes.Good;
|
public StatusCode ShelveResult { get; set; } = StatusCodes.Good;
|
||||||
|
/// <summary>Gets or sets the exception thrown to simulate alarm shelve failures in the UI.</summary>
|
||||||
|
public Exception? ShelveException { get; set; }
|
||||||
|
/// <summary>Gets the number of times ShelveAlarmAsync has been called.</summary>
|
||||||
|
public int ShelveCallCount { get; private set; }
|
||||||
|
/// <summary>Gets the (conditionNodeId, kind, shelvingTimeSeconds) of the last ShelveAlarmAsync call.</summary>
|
||||||
|
public (string ConditionNodeId, ShelveKind Kind, double ShelvingTimeSeconds)? LastShelveCall { get; private set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task<StatusCode> ShelveAlarmAsync(string conditionNodeId, ShelveKind kind, double shelvingTimeSeconds = 0,
|
public Task<StatusCode> ShelveAlarmAsync(string conditionNodeId, ShelveKind kind, double shelvingTimeSeconds = 0,
|
||||||
CancellationToken ct = default)
|
CancellationToken ct = default)
|
||||||
{
|
{
|
||||||
|
ShelveCallCount++;
|
||||||
|
LastShelveCall = (conditionNodeId, kind, shelvingTimeSeconds);
|
||||||
|
if (ShelveException != null) throw ShelveException;
|
||||||
return Task.FromResult(ShelveResult);
|
return Task.FromResult(ShelveResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user