test(adminui): migrate AdminUI.Tests to v3 greenfield schema + Batch-1 stubs

Migrate tests/Server/ZB.MOM.WW.OtOpcUa.AdminUI.Tests (was 358 build errors) to
the v3 Raw-only Tag schema and the Batch-1 AdminUI stubs. Production untouched.

- Driver-page serialization tests: drop the retired pre-declared Tags editor
  (page *TagRow types + DriverOptions.Tags); multi-device pages keep their
  Devices editor (ToOptions(devices)). Enum-serialization round-trip coverage
  (CpuType/ModbusFamily/MelsecFamily/AbCipPlcFamily/AbLegacyPlcFamily/FocasCncSeries)
  preserved intact.
- UnsTreeTestDb: reseed to v3 (Device->Tag raw slice, no EquipmentId/DriverInstanceId
  on Tag, no Namespace).
- UnsTreeService tag tests: assert Batch-1 stubs (CreateTag/UpdateTag refusal,
  empty tag/tag-driver lists); DeleteTag stays live against a raw Tag.
- Equipment #122 guard retained (validates input driver vs line cluster); drop the
  retired persisted-binding assertions + NamespaceId seeds. Area/Line #122 driver-
  orphan guard retired -> assert cross-cluster move now succeeds.
- DeleteCluster: drop the deleted-Namespace child-check test.
- OpcUaClientTagConfigModel/TagConfigValidator: address key FullName -> nodeId.
- ScriptTagCatalog: project surviving Name/DataType/TagConfig; DriverInstanceId null.
- VirtualTag {{equip}} equipment-tag-derived base is dark -> 3 tests skipped (Batch-3).

Result: build green; 507 passed / 3 skipped / 0 failed.
This commit is contained in:
Joseph Doherty
2026-07-15 21:50:48 -04:00
parent aaba2ebd66
commit 6a616a1ab2
22 changed files with 266 additions and 1029 deletions
@@ -41,7 +41,6 @@ public sealed class UnsTreeServiceEquipmentTests
{
DriverInstanceId = "DRV-1",
ClusterId = driverCluster,
NamespaceId = "NS-1",
Name = "drv",
DriverType = "Modbus",
DriverConfig = "{}",
@@ -125,7 +124,11 @@ public sealed class UnsTreeServiceEquipmentTests
db.Equipment.Any(e => e.MachineCode == "machine_001").ShouldBeFalse();
}
/// <summary>Binding equipment to a driver in the same cluster as the line is allowed.</summary>
/// <summary>
/// Passing a driver in the same cluster as the line passes the #122 guard and the equipment
/// persists. v3: the equipment↔driver binding column was retired, so the driver is validated by
/// the guard but not stored — the assertion drops to equipment existence.
/// </summary>
[Fact]
public async Task CreateEquipment_driver_in_same_cluster_allowed()
{
@@ -138,7 +141,7 @@ public sealed class UnsTreeServiceEquipmentTests
result.Error.ShouldBeNull();
using var db = UnsTreeTestDb.CreateNamed(dbName);
db.Equipment.Single(e => e.MachineCode == "machine_001").DriverInstanceId.ShouldBe("DRV-1");
db.Equipment.Single(e => e.MachineCode == "machine_001").UnsLineId.ShouldBe("LINE-1");
}
/// <summary>Driver-less equipment is allowed regardless of cluster (no #122 guard applies).</summary>
@@ -154,7 +157,7 @@ public sealed class UnsTreeServiceEquipmentTests
result.Error.ShouldBeNull();
using var db = UnsTreeTestDb.CreateNamed(dbName);
db.Equipment.Single(e => e.MachineCode == "machine_001").DriverInstanceId.ShouldBeNull();
db.Equipment.Single(e => e.MachineCode == "machine_001").UnsLineId.ShouldBe("LINE-1");
}
/// <summary>
@@ -172,7 +175,6 @@ public sealed class UnsTreeServiceEquipmentTests
{
DriverInstanceId = "DRV-1",
ClusterId = "MAIN",
NamespaceId = "NS-1",
Name = "drv",
DriverType = "Modbus",
DriverConfig = "{}",
@@ -286,8 +288,9 @@ public sealed class UnsTreeServiceEquipmentTests
result.Error.ShouldNotBeNull();
result.Error.ShouldContain("decision #122");
// The equipment row is unchanged (v3 has no persisted driver-binding column to check).
using var verify = UnsTreeTestDb.CreateNamed(dbName);
verify.Equipment.Single(e => e.EquipmentId == equipmentId).DriverInstanceId.ShouldBeNull();
verify.Equipment.Single(e => e.EquipmentId == equipmentId).MachineCode.ShouldBe("machine_001");
}
/// <summary>Updating equipment with a MachineCode that already belongs to another row is blocked.</summary>
@@ -344,8 +347,9 @@ public sealed class UnsTreeServiceEquipmentTests
result.Ok.ShouldBeTrue();
result.Error.ShouldBeNull();
// v3: the driver passes the #122 guard but is not persisted (binding column retired).
using var verify = UnsTreeTestDb.CreateNamed(dbName);
verify.Equipment.Single(e => e.EquipmentId == equipmentId).DriverInstanceId.ShouldBe("DRV-1");
verify.Equipment.Single(e => e.EquipmentId == equipmentId).UnsLineId.ShouldBe("LINE-1");
}
/// <summary>CreateEquipmentAsync returns the generated EQ- id in <c>CreatedId</c> so callers can navigate to the new page.</summary>