test: pass TestContext.Current.CancellationToken at xUnit1051 call sites (analyzer code fix, 451 sites) (lmxopcua#725)

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-09 13:19:34 -05:00
parent 5db01053e8
commit 1d7a4b7a53
77 changed files with 452 additions and 457 deletions
@@ -86,7 +86,7 @@ public sealed class ModbusSubscriptionTests
drv.OnDataChange += (_, e) => events.Enqueue(e);
var handle = await drv.SubscribeAsync(["Level"], TimeSpan.FromMilliseconds(100), CancellationToken.None);
await Task.Delay(500); // ~5 poll cycles at 100ms, value stable the whole time
await Task.Delay(500, TestContext.Current.CancellationToken); // ~5 poll cycles at 100ms, value stable the whole time
await drv.UnsubscribeAsync(handle, CancellationToken.None);
events.Count.ShouldBe(1); // only the initial-data push, no change events after
@@ -129,7 +129,7 @@ public sealed class ModbusSubscriptionTests
var countAfterUnsub = events.Count;
fake.HoldingRegisters[0] = 999; // would trigger a change if still polling
await Task.Delay(400);
await Task.Delay(400, TestContext.Current.CancellationToken);
events.Count.ShouldBe(countAfterUnsub);
}
@@ -147,7 +147,7 @@ public sealed class ModbusSubscriptionTests
drv.OnDataChange += (_, e) => events.Enqueue(e);
var handle = await drv.SubscribeAsync(["Level"], TimeSpan.FromMilliseconds(10), CancellationToken.None);
await Task.Delay(300);
await Task.Delay(300, TestContext.Current.CancellationToken);
await drv.UnsubscribeAsync(handle, CancellationToken.None);
events.Count.ShouldBe(1);
@@ -227,7 +227,7 @@ public sealed class ModbusSubscriptionTests
{
for (var i = 0; i < tagCount; i++)
fake.HoldingRegisters[i] = (ushort)(fake.HoldingRegisters[i] + 5);
await Task.Delay(20);
await Task.Delay(20, TestContext.Current.CancellationToken);
}
foreach (var h in handles)