fix(historian-gateway): dispose alarm-write channel at shutdown + ServerHistorian startup diagnostic
Claude-Session: https://claude.ai/code/session_012SDSQ3AcaXqPcBtDESBRii
This commit is contained in:
+16
@@ -199,4 +199,20 @@ public sealed class GatewayAlarmHistorianWriterTests
|
||||
|
||||
Assert.Empty(outcomes);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Dispose_with_async_only_client_does_not_throw()
|
||||
{
|
||||
// FakeHistorianGatewayClient implements IAsyncDisposable only — not IDisposable.
|
||||
// The `as IDisposable` guard in GatewayAlarmHistorianWriter.Dispose() must safely
|
||||
// no-op rather than throw when the client cannot be cast to IDisposable.
|
||||
var fake = new FakeHistorianGatewayClient();
|
||||
var writer = Writer(fake);
|
||||
|
||||
var ex = Record.Exception(() => ((IDisposable)writer).Dispose());
|
||||
|
||||
Assert.Null(ex);
|
||||
// The Fake is IAsyncDisposable only; the sync Dispose must not call DisposeAsync.
|
||||
Assert.Equal(0, fake.DisposeCallCount);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user