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
@@ -9,8 +9,10 @@ namespace ZB.MOM.WW.OtOpcUa.AdminUI.Tests.Uns;
/// Shared in-memory fixture for <c>UnsTreeService</c> structural tests. Builds an
/// <see cref="OtOpcUaConfigDbContext"/> over a named InMemory database and seeds a small,
/// deterministic UNS hierarchy: enterprise "zb" across two clusters (MAIN populated,
/// SITE-A intentionally empty), plus tags and a virtual tag on one equipment node so
/// the per-equipment count joins can be exercised.
/// SITE-A intentionally empty), a virtual tag on one equipment node (so the per-equipment
/// virtual-tag count join can be exercised), plus a v3 Raw-tree slice
/// (Driver→Device→Tag). Under v3, tags are Raw-only — they no longer bind to equipment — so
/// the per-equipment driver-tag count is always zero; only the virtual-tag count join remains.
/// </summary>
internal static class UnsTreeTestDb
{
@@ -84,12 +86,22 @@ internal static class UnsTreeTestDb
MachineCode = "machine_001",
});
// Two driver tags + one virtual tag on the seeded equipment → ChildCount 3.
// v3 Raw tree: a device → two raw tags. Tags are Raw-only and no longer bind to equipment,
// so they do NOT contribute to any per-equipment count. The owning DriverInstance is left
// unseeded on purpose — no structural test reads it, and seeding one would pollute the
// per-cluster driver-list assertions in UnsTreeServiceLoadEditTests (EF InMemory does not
// enforce the Device→Driver FK).
db.Devices.Add(new Device
{
DeviceId = "DEV-1",
DriverInstanceId = "DRV-1",
Name = "device-1",
DeviceConfig = "{}",
});
db.Tags.Add(new Tag
{
TagId = "TAG-1",
DriverInstanceId = "DRV-1",
EquipmentId = SeededEquipmentId,
DeviceId = "DEV-1",
Name = "speed",
DataType = "Float",
AccessLevel = TagAccessLevel.Read,
@@ -98,24 +110,14 @@ internal static class UnsTreeTestDb
db.Tags.Add(new Tag
{
TagId = "TAG-2",
DriverInstanceId = "DRV-1",
EquipmentId = SeededEquipmentId,
DeviceId = "DEV-1",
Name = "running",
DataType = "Boolean",
AccessLevel = TagAccessLevel.Read,
TagConfig = "{}",
});
// A tag with no equipment must be ignored by the count query.
db.Tags.Add(new Tag
{
TagId = "TAG-ORPHAN",
DriverInstanceId = "DRV-1",
EquipmentId = null,
Name = "orphan",
DataType = "Int32",
AccessLevel = TagAccessLevel.Read,
TagConfig = "{}",
});
// One virtual tag on the seeded equipment → per-equipment virtual-tag ChildCount 1.
db.VirtualTags.Add(new VirtualTag
{
VirtualTagId = "VTAG-1",