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:
@@ -74,7 +74,7 @@ public sealed class CalculationDriverTests
|
||||
{
|
||||
var (driver, published, _) = Build(
|
||||
CalcTag("calc/e/sum", "return (double)ctx.GetTag(\"src/a\").Value + (double)ctx.GetTag(\"src/b\").Value;"));
|
||||
await driver.InitializeAsync("{}", default);
|
||||
await driver.InitializeAsync("{}", TestContext.Current.CancellationToken);
|
||||
|
||||
// Only one of two deps arrived → the change-gate holds.
|
||||
driver.OnDependencyValue("src/a", 10.0, StatusGood, DateTime.UtcNow);
|
||||
@@ -197,7 +197,7 @@ public sealed class CalculationDriverTests
|
||||
{
|
||||
var (driver, published, _) = Build(
|
||||
CalcTag("calc/e/dbl", "return (double)ctx.GetTag(\"src/a\").Value * 2.0;"));
|
||||
await driver.InitializeAsync("{}", default);
|
||||
await driver.InitializeAsync("{}", TestContext.Current.CancellationToken);
|
||||
|
||||
// Each arrival is queued with the dependency snapshot that triggered it, so the three evaluations
|
||||
// see 5 / 5 / 7 in that order however far the pump lags behind them.
|
||||
@@ -216,7 +216,7 @@ public sealed class CalculationDriverTests
|
||||
{
|
||||
var (driver, published, logs) = Build(
|
||||
CalcTag("calc/e/div", "return 100 / (int)ctx.GetTag(\"src/a\").Value;"));
|
||||
await driver.InitializeAsync("{}", default);
|
||||
await driver.InitializeAsync("{}", TestContext.Current.CancellationToken);
|
||||
|
||||
// a = 0 → DivideByZero → Failure → Bad (carrying last-known = null) + one script-log.
|
||||
driver.OnDependencyValue("src/a", 0, StatusGood, DateTime.UtcNow);
|
||||
@@ -254,7 +254,7 @@ public sealed class CalculationDriverTests
|
||||
// No dependencies (constant script) so only the timer can drive it.
|
||||
var (driver, published, _) = Build(
|
||||
CalcTag("calc/e/const", "return 42.0;", changeTriggered: false, timerMs: 50));
|
||||
await driver.InitializeAsync("{}", default);
|
||||
await driver.InitializeAsync("{}", TestContext.Current.CancellationToken);
|
||||
|
||||
var fired = await WaitUntil(() => !published.IsEmpty, TimeSpan.FromSeconds(3));
|
||||
fired.ShouldBeTrue("the timer trigger should have computed the tag within 3s");
|
||||
@@ -262,7 +262,7 @@ public sealed class CalculationDriverTests
|
||||
e!.FullReference.ShouldBe("calc/e/const");
|
||||
e.Snapshot.Value.ShouldBe(42.0);
|
||||
|
||||
await driver.ShutdownAsync(default);
|
||||
await driver.ShutdownAsync(TestContext.Current.CancellationToken);
|
||||
}
|
||||
|
||||
// ── IReadable ─────────────────────────────────────────────────────────────────────────────
|
||||
@@ -271,14 +271,14 @@ public sealed class CalculationDriverTests
|
||||
public async Task Read_returns_BadWaitingForInitialData_before_first_eval_then_the_computed_value()
|
||||
{
|
||||
var (driver, _, _) = Build(CalcTag("calc/e/x", "return (double)ctx.GetTag(\"src/a\").Value * 2.0;"));
|
||||
await driver.InitializeAsync("{}", default);
|
||||
await driver.InitializeAsync("{}", TestContext.Current.CancellationToken);
|
||||
|
||||
var before = await driver.ReadAsync(new[] { "calc/e/x" }, default);
|
||||
var before = await driver.ReadAsync(new[] { "calc/e/x" }, TestContext.Current.CancellationToken);
|
||||
before[0].StatusCode.ShouldBe(StatusBadWaitingForInitialData);
|
||||
|
||||
driver.OnDependencyValue("src/a", 3.0, StatusGood, DateTime.UtcNow);
|
||||
await Settle(driver);
|
||||
var after = await driver.ReadAsync(new[] { "calc/e/x" }, default);
|
||||
var after = await driver.ReadAsync(new[] { "calc/e/x" }, TestContext.Current.CancellationToken);
|
||||
after[0].StatusCode.ShouldBe(StatusGood);
|
||||
after[0].Value.ShouldBe(6.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user