test: migrate AdminUI/ControlPlane/Runtime/Host tests to xunit.v3 (#756)
v2-ci / unit-tests (push) Failing after 13m22s

Akka.TestKit.Xunit2 -> Akka.TestKit.Xunit 1.5.62 (xunit.v3 TestKit; needs xunit.v3 3.2.2, set via
VersionOverride on the four projects). Removes the xunit 2.9.3 pin. IAsyncLifetime returns ValueTask,
SqlServerFactAttribute gains the source-info ctor, and xUnit1051 call sites pass
TestContext.Current.CancellationToken. Test counts unchanged.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-10 08:57:33 -05:00
parent 2a8e2981fe
commit b211911f98
191 changed files with 2161 additions and 2166 deletions
@@ -21,16 +21,16 @@ public sealed class UnsTreeServiceScriptedAlarmTests
public async Task Create_then_list_and_load_roundtrips()
{
var svc = SeededService();
var create = await svc.CreateScriptedAlarmAsync(UnsTreeTestDb.SeededEquipmentId, Sample());
var create = await svc.CreateScriptedAlarmAsync(UnsTreeTestDb.SeededEquipmentId, Sample(), TestContext.Current.CancellationToken);
create.Ok.ShouldBeTrue();
create.CreatedId.ShouldBe("SA-1");
var rows = await svc.LoadAlarmsForEquipmentAsync(UnsTreeTestDb.SeededEquipmentId);
var rows = await svc.LoadAlarmsForEquipmentAsync(UnsTreeTestDb.SeededEquipmentId, TestContext.Current.CancellationToken);
rows.Count.ShouldBe(1);
rows[0].Name.ShouldBe("Over-temp");
rows[0].Severity.ShouldBe(700);
var dto = await svc.LoadScriptedAlarmAsync("SA-1");
var dto = await svc.LoadScriptedAlarmAsync("SA-1", TestContext.Current.CancellationToken);
dto.ShouldNotBeNull();
dto!.EquipmentId.ShouldBe(UnsTreeTestDb.SeededEquipmentId);
dto.HistorizeToAveva.ShouldBeTrue();
@@ -41,8 +41,8 @@ public sealed class UnsTreeServiceScriptedAlarmTests
public async Task Create_rejects_duplicate_id()
{
var svc = SeededService();
(await svc.CreateScriptedAlarmAsync(UnsTreeTestDb.SeededEquipmentId, Sample())).Ok.ShouldBeTrue();
var dup = await svc.CreateScriptedAlarmAsync(UnsTreeTestDb.SeededEquipmentId, Sample());
(await svc.CreateScriptedAlarmAsync(UnsTreeTestDb.SeededEquipmentId, Sample(), TestContext.Current.CancellationToken)).Ok.ShouldBeTrue();
var dup = await svc.CreateScriptedAlarmAsync(UnsTreeTestDb.SeededEquipmentId, Sample(), TestContext.Current.CancellationToken);
dup.Ok.ShouldBeFalse();
dup.Error.ShouldNotBeNull();
}
@@ -51,14 +51,14 @@ public sealed class UnsTreeServiceScriptedAlarmTests
public async Task Update_changes_fields()
{
var svc = SeededService();
await svc.CreateScriptedAlarmAsync(UnsTreeTestDb.SeededEquipmentId, Sample());
var dto = await svc.LoadScriptedAlarmAsync("SA-1");
await svc.CreateScriptedAlarmAsync(UnsTreeTestDb.SeededEquipmentId, Sample(), TestContext.Current.CancellationToken);
var dto = await svc.LoadScriptedAlarmAsync("SA-1", TestContext.Current.CancellationToken);
var upd = await svc.UpdateScriptedAlarmAsync("SA-1",
Sample() with { Name = "Renamed", Severity = 250, HistorizeToAveva = false }, dto!.RowVersion);
Sample() with { Name = "Renamed", Severity = 250, HistorizeToAveva = false }, dto!.RowVersion, TestContext.Current.CancellationToken);
upd.Ok.ShouldBeTrue();
var after = await svc.LoadScriptedAlarmAsync("SA-1");
var after = await svc.LoadScriptedAlarmAsync("SA-1", TestContext.Current.CancellationToken);
after!.Name.ShouldBe("Renamed");
after.Severity.ShouldBe(250);
after.HistorizeToAveva.ShouldBeFalse();
@@ -68,20 +68,20 @@ public sealed class UnsTreeServiceScriptedAlarmTests
public async Task Delete_removes_row()
{
var svc = SeededService();
await svc.CreateScriptedAlarmAsync(UnsTreeTestDb.SeededEquipmentId, Sample());
var dto = await svc.LoadScriptedAlarmAsync("SA-1");
await svc.CreateScriptedAlarmAsync(UnsTreeTestDb.SeededEquipmentId, Sample(), TestContext.Current.CancellationToken);
var dto = await svc.LoadScriptedAlarmAsync("SA-1", TestContext.Current.CancellationToken);
(await svc.DeleteScriptedAlarmAsync("SA-1", dto!.RowVersion)).Ok.ShouldBeTrue();
(await svc.LoadAlarmsForEquipmentAsync(UnsTreeTestDb.SeededEquipmentId)).ShouldBeEmpty();
(await svc.DeleteScriptedAlarmAsync("SA-1", dto!.RowVersion, TestContext.Current.CancellationToken)).Ok.ShouldBeTrue();
(await svc.LoadAlarmsForEquipmentAsync(UnsTreeTestDb.SeededEquipmentId, TestContext.Current.CancellationToken)).ShouldBeEmpty();
}
[Fact]
public async Task Create_rejects_duplicate_name_on_same_equipment()
{
var svc = SeededService();
(await svc.CreateScriptedAlarmAsync(UnsTreeTestDb.SeededEquipmentId, Sample("SA-1"))).Ok.ShouldBeTrue();
(await svc.CreateScriptedAlarmAsync(UnsTreeTestDb.SeededEquipmentId, Sample("SA-1"), TestContext.Current.CancellationToken)).Ok.ShouldBeTrue();
// Same Name ("Over-temp" from Sample), different id, same equipment → rejected.
var dup = await svc.CreateScriptedAlarmAsync(UnsTreeTestDb.SeededEquipmentId, Sample("SA-2"));
var dup = await svc.CreateScriptedAlarmAsync(UnsTreeTestDb.SeededEquipmentId, Sample("SA-2"), TestContext.Current.CancellationToken);
dup.Ok.ShouldBeFalse();
dup.Error.ShouldNotBeNull();
dup.Error!.ShouldContain("already exists");
@@ -91,10 +91,10 @@ public sealed class UnsTreeServiceScriptedAlarmTests
public async Task LoadAlarmsForEquipment_excludes_other_equipment()
{
var svc = SeededService();
await svc.CreateScriptedAlarmAsync(UnsTreeTestDb.SeededEquipmentId, Sample("SA-MINE"));
await svc.CreateScriptedAlarmAsync("EQ-OTHER", Sample("SA-OTHER") with { Name = "Other-alarm" });
await svc.CreateScriptedAlarmAsync(UnsTreeTestDb.SeededEquipmentId, Sample("SA-MINE"), TestContext.Current.CancellationToken);
await svc.CreateScriptedAlarmAsync("EQ-OTHER", Sample("SA-OTHER") with { Name = "Other-alarm" }, TestContext.Current.CancellationToken);
var rows = await svc.LoadAlarmsForEquipmentAsync(UnsTreeTestDb.SeededEquipmentId);
var rows = await svc.LoadAlarmsForEquipmentAsync(UnsTreeTestDb.SeededEquipmentId, TestContext.Current.CancellationToken);
rows.Count.ShouldBe(1);
rows[0].ScriptedAlarmId.ShouldBe("SA-MINE");