test: remaining xUnit1051/1031/1030, CS8602/8604, CS0618, CS0219, CS0649, NU1510 fixes (lmxopcua#725)
v2-ci / unit-tests (push) Has been cancelled
v2-ci / unit-tests (push) Has been cancelled
Awaited deadline oracles get the runner token; sync-over-async tests made async; nullable child models asserted via ShouldNotBeNull() return values; obsolete SDK ctors replaced with the telemetry overloads; dead locals/fixture and the redundant DI PackageReference removed. No suppressions. Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
@@ -739,7 +739,7 @@ public sealed class ScriptedAlarmEngineTests
|
||||
|
||||
up.Push("Temp", 150);
|
||||
|
||||
var winner = await Task.WhenAny(ackDone.Task, Task.Delay(TimeSpan.FromSeconds(3)));
|
||||
var winner = await Task.WhenAny(ackDone.Task, Task.Delay(TimeSpan.FromSeconds(3), TestContext.Current.CancellationToken));
|
||||
winner.ShouldBe(ackDone.Task,
|
||||
"subscriber re-entering the engine must not deadlock against _evalGate");
|
||||
await ackDone.Task; // surface any inner exception
|
||||
@@ -753,7 +753,7 @@ public sealed class ScriptedAlarmEngineTests
|
||||
|
||||
/// <summary>Verifies that OnEvent emission occurs after the evaluation gate is released, so subscribers can re-enter the engine without deadlocking (regression for Core.ScriptedAlarms-003).</summary>
|
||||
[Fact]
|
||||
public void OnEvent_emission_happens_outside_evalGate(/* -003 */)
|
||||
public async Task OnEvent_emission_happens_outside_evalGate(/* -003 */)
|
||||
{
|
||||
// Direct white-box check on the gate-release ordering: AcknowledgeAsync
|
||||
// emits the Acknowledged event AFTER releasing the gate. We assert that
|
||||
@@ -764,8 +764,8 @@ public sealed class ScriptedAlarmEngineTests
|
||||
var eng = Build(up, out _);
|
||||
try
|
||||
{
|
||||
eng.LoadAsync([Alarm("HighTemp", """return (int)ctx.GetTag("Temp").Value > 100;""")],
|
||||
TestContext.Current.CancellationToken).GetAwaiter().GetResult();
|
||||
await eng.LoadAsync([Alarm("HighTemp", """return (int)ctx.GetTag("Temp").Value > 100;""")],
|
||||
TestContext.Current.CancellationToken);
|
||||
// Drive to Active so Acknowledge has something to ack.
|
||||
up.Push("Temp", 150);
|
||||
// Use the same WaitForAsync that other tests use — synchronously
|
||||
@@ -796,8 +796,7 @@ public sealed class ScriptedAlarmEngineTests
|
||||
}
|
||||
};
|
||||
|
||||
eng.AcknowledgeAsync("HighTemp", "alice", null, CancellationToken.None)
|
||||
.GetAwaiter().GetResult();
|
||||
await eng.AcknowledgeAsync("HighTemp", "alice", null, CancellationToken.None);
|
||||
|
||||
gateFreeInsideEmission.ShouldBeTrue(
|
||||
"_evalGate must be released before OnEvent fires so subscribers " +
|
||||
@@ -844,7 +843,7 @@ public sealed class ScriptedAlarmEngineTests
|
||||
// Verify Dispose does NOT complete immediately — it should block waiting
|
||||
// for the in-flight task. Without the -006 fix Dispose returns straight
|
||||
// away and the background reevaluation can outlive the engine.
|
||||
var prematureFinish = await Task.WhenAny(disposeTask, Task.Delay(200));
|
||||
var prematureFinish = await Task.WhenAny(disposeTask, Task.Delay(200, TestContext.Current.CancellationToken));
|
||||
prematureFinish.ShouldNotBe(disposeTask,
|
||||
"Dispose must block until in-flight background tasks complete");
|
||||
|
||||
@@ -1749,7 +1748,7 @@ public sealed class ScriptedAlarmEngineTests
|
||||
eng.InFlightCountForTest.ShouldBe(1);
|
||||
|
||||
var disposeTask = Task.Run(() => eng.Dispose(), TestContext.Current.CancellationToken);
|
||||
var raced = await Task.WhenAny(disposeTask, Task.Delay(300));
|
||||
var raced = await Task.WhenAny(disposeTask, Task.Delay(300, TestContext.Current.CancellationToken));
|
||||
raced.ShouldNotBe(disposeTask, "Dispose must not return while registered background work is still running");
|
||||
|
||||
gate.SetResult();
|
||||
|
||||
Reference in New Issue
Block a user