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
@@ -15,9 +15,11 @@ namespace ZB.MOM.WW.OtOpcUa.AdminUI.Tests.ScriptAnalysis;
/// <remarks>
/// Fidelity finding (see <see cref="ScriptTagCatalog"/> doc comment): the runtime Akka path resolves
/// a <c>ctx.GetTag</c> literal against the driver <b>FullName</b> (the wire reference in
/// <c>Tag.TagConfig.FullName</c>), NOT the UNS browse path — the UNS-path engine is dormant. The
/// catalog therefore emits the FullName for equipment tags, the MXAccess dot-ref for FolderPath-scoped
/// tags (EquipmentId null), and the leaf Name for virtual tags, and deliberately omits UNS browse paths. These
/// <c>Tag.TagConfig.FullName</c>), NOT the UNS browse path — the UNS-path engine is dormant. v3: Tag is
/// Raw-only (no <c>EquipmentId</c>/<c>FolderPath</c>/<c>DriverInstanceId</c>), so the catalog projects
/// the surviving <c>Name</c>/<c>DataType</c>/<c>TagConfig</c> columns: the resolvable path derives from
/// the <c>TagConfig.FullName</c> field when present, else the tag <c>Name</c>; the projected
/// <c>DriverInstanceId</c> is always <see langword="null"/>. Virtual tags emit their leaf Name. These
/// assertions check the resolvable key is present AND that the UNS browse paths are absent.
/// </remarks>
[Trait("Category", "Unit")]
@@ -59,26 +61,23 @@ public sealed class ScriptTagCatalogTests
MachineCode = "machine_001",
});
// Equipment driver tag — the GetTag key is the driver FullName from TagConfig.
// Raw tag — the GetTag key is the driver FullName from TagConfig.
db.Tags.Add(new Tag
{
TagId = "TAG-EQ",
DriverInstanceId = "DRV-1",
EquipmentId = "EQ-1",
DeviceId = "DEV-1",
Name = "Speed",
DataType = "Float",
AccessLevel = TagAccessLevel.Read,
TagConfig = "{\"FullName\":\"Motor.Speed\"}",
});
// FolderPath-scoped tag — EquipmentId null, FolderPath set; subscribes by "FolderPath.Name".
// Raw tag whose FullName is an MXAccess dot-ref; resolves by that FullName.
db.Tags.Add(new Tag
{
TagId = "TAG-SP",
DriverInstanceId = "DRV-GALAXY",
EquipmentId = null,
DeviceId = "DEV-1",
Name = "DownloadPath",
FolderPath = "DelmiaReceiver_001",
DataType = "String",
AccessLevel = TagAccessLevel.Read,
TagConfig = "{\"FullName\":\"DelmiaReceiver_001.DownloadPath\"}",
@@ -174,8 +173,7 @@ public sealed class ScriptTagCatalogTests
db.Tags.Add(new Tag
{
TagId = "TAG-BAD",
DriverInstanceId = "DRV-1",
EquipmentId = "EQ-1",
DeviceId = "DEV-1",
Name = "Broken",
DataType = "Float",
AccessLevel = TagAccessLevel.Read,
@@ -205,10 +203,8 @@ public sealed class ScriptTagCatalogTests
db.Tags.Add(new Tag
{
TagId = "TAG-SP-ROOT",
DriverInstanceId = "DRV-GALAXY",
EquipmentId = null,
DeviceId = "DEV-1",
Name = "RootScalar",
FolderPath = null,
DataType = "String",
AccessLevel = TagAccessLevel.Read,
TagConfig = "{\"FullName\":\"RootScalar\"}",
@@ -233,8 +229,8 @@ public sealed class ScriptTagCatalogTests
paths.ShouldBeEmpty();
}
/// <summary>A FolderPath-scoped tag resolves by its "FolderPath.Name" dot-ref to a Tag-kind info
/// with the configured DataType + DriverInstanceId.</summary>
/// <summary>A raw tag whose FullName is a dot-ref resolves by that FullName to a Tag-kind info with
/// the configured DataType. v3: Tag no longer binds a driver, so the projected DriverInstanceId is null.</summary>
[Fact]
public async Task GetTagInfo_unbound_tag_returns_tag_info()
{
@@ -247,7 +243,7 @@ public sealed class ScriptTagCatalogTests
info!.Path.ShouldBe("DelmiaReceiver_001.DownloadPath");
info.Kind.ShouldBe("Tag");
info.DataType.ShouldBe("String");
info.DriverInstanceId.ShouldBe("DRV-GALAXY");
info.DriverInstanceId.ShouldBeNull();
}
/// <summary>A virtual tag resolves by its leaf Name to a "Virtual tag"-kind info with no driver.</summary>
@@ -353,8 +349,7 @@ public sealed class ScriptTagCatalogTests
db.Tags.Add(new Tag
{
TagId = "TAG-EQ2",
DriverInstanceId = "DRV-1",
EquipmentId = "EQ-1",
DeviceId = "DEV-1",
Name = "Speed2",
DataType = "Float",
AccessLevel = TagAccessLevel.Read,