feat(opcuaclient): implement IHistoryProvider.ReadEventsAsync passthrough

This commit is contained in:
Joseph Doherty
2026-06-18 06:07:32 -04:00
parent d48674ba31
commit 045f9ca2e8
2 changed files with 78 additions and 13 deletions
@@ -80,16 +80,13 @@ public sealed class OpcUaClientHistoryTests
TestContext.Current.CancellationToken));
}
/// <summary>Verifies ReadEventsAsync throws NotSupportedException as documented.</summary>
/// <summary>ReadEventsAsync requires an initialized session like the sibling history reads.</summary>
[Fact]
public async Task ReadEventsAsync_throws_NotSupportedException_as_documented()
public async Task ReadEventsAsync_without_initialize_throws_InvalidOperationException()
{
// The IHistoryProvider default implementation throws; the OPC UA Client driver
// deliberately inherits that default (see PR 76 commit body) because the OPC UA
// client call path needs an EventFilter SelectClauses spec the interface doesn't carry.
using var drv = new OpcUaClientDriver(new OpcUaClientDriverOptions(), "opcua-events-default");
await Should.ThrowAsync<NotSupportedException>(async () =>
await ((IHistoryProvider)drv).ReadEventsAsync(
using var drv = new OpcUaClientDriver(new OpcUaClientDriverOptions(), "opcua-events-uninit");
await Should.ThrowAsync<InvalidOperationException>(async () =>
await drv.ReadEventsAsync(
sourceName: null,
startUtc: DateTime.UtcNow.AddMinutes(-5),
endUtc: DateTime.UtcNow,