Resolve all high-severity architecture review findings
This commit is contained in:
+24
@@ -26,6 +26,30 @@ public class MxGatewayBatchSeamTests
|
||||
["ReadTimeoutMs"] = "2000",
|
||||
};
|
||||
|
||||
[Theory]
|
||||
[InlineData(false)]
|
||||
[InlineData(true)]
|
||||
public async Task UnsubscribeOldHandle_PreservesNewHandleRouting(bool batch)
|
||||
{
|
||||
var fake = new FakeMxGatewayClient();
|
||||
await using var adapter = NewAdapter(fake);
|
||||
await adapter.ConnectAsync(Details());
|
||||
var received = new List<object?>();
|
||||
var old = await adapter.SubscribeAsync("A.x", (_, value) => received.Add(value.Value));
|
||||
await adapter.SubscribeAsync("A.x", (_, value) => received.Add(value.Value));
|
||||
if (batch) await adapter.UnsubscribeBatchAsync([old]);
|
||||
else await adapter.UnsubscribeAsync(old);
|
||||
await WaitUntilAsync(() => fake.OnUpdate != null);
|
||||
fake.OnUpdate!(new MxValueUpdate("A.x", 7, QualityCode.Good, DateTimeOffset.UtcNow));
|
||||
Assert.Equal([7], received);
|
||||
}
|
||||
|
||||
private static async Task WaitUntilAsync(Func<bool> condition)
|
||||
{
|
||||
using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(2));
|
||||
while (!condition()) await Task.Delay(10, timeout.Token);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task SubscribeBatch_IssuesExactlyOneBulkCallPerBatch()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user