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:
+9
-59
@@ -41,11 +41,6 @@ public sealed class AbLegacyDriverPageFormSerializationTests
|
||||
new AbLegacyDeviceOptions("10.0.0.10", AbLegacyPlcFamily.Slc500, "PLC-A"),
|
||||
new AbLegacyDeviceOptions("10.0.0.11", AbLegacyPlcFamily.MicroLogix),
|
||||
],
|
||||
Tags =
|
||||
[
|
||||
new AbLegacyTagDefinition("Level", "10.0.0.10", "N7:5", AbLegacyDataType.Int, Writable: false),
|
||||
new AbLegacyTagDefinition("Pump", "10.0.0.10", "B3:0/0", AbLegacyDataType.Bit, Writable: true),
|
||||
],
|
||||
};
|
||||
|
||||
var json = JsonSerializer.Serialize(original, _opts);
|
||||
@@ -63,12 +58,6 @@ public sealed class AbLegacyDriverPageFormSerializationTests
|
||||
back.Devices[0].PlcFamily.ShouldBe(AbLegacyPlcFamily.Slc500);
|
||||
back.Devices[0].DeviceName.ShouldBe("PLC-A");
|
||||
back.Devices[1].PlcFamily.ShouldBe(AbLegacyPlcFamily.MicroLogix);
|
||||
back.Tags.Count.ShouldBe(2);
|
||||
back.Tags[0].Name.ShouldBe("Level");
|
||||
back.Tags[0].Address.ShouldBe("N7:5");
|
||||
back.Tags[0].DataType.ShouldBe(AbLegacyDataType.Int);
|
||||
back.Tags[0].Writable.ShouldBeFalse();
|
||||
back.Tags[1].DataType.ShouldBe(AbLegacyDataType.Bit);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -114,37 +103,11 @@ public sealed class AbLegacyDriverPageFormSerializationTests
|
||||
back.DeviceName.ShouldBe("PLC-A");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TagRow_round_trips_through_definition()
|
||||
{
|
||||
var row = new AbLegacyDriverPage.AbLegacyTagRow
|
||||
{
|
||||
Name = "Level", DeviceHostAddress = "10.0.0.10", Address = "N7:5",
|
||||
DataType = AbLegacyDataType.Int, Writable = true,
|
||||
};
|
||||
var def = row.ToDefinition();
|
||||
var back = AbLegacyDriverPage.AbLegacyTagRow.FromDefinition(def);
|
||||
|
||||
back.Name.ShouldBe("Level");
|
||||
back.DeviceHostAddress.ShouldBe("10.0.0.10");
|
||||
back.Address.ShouldBe("N7:5");
|
||||
back.DataType.ShouldBe(AbLegacyDataType.Int);
|
||||
back.Writable.ShouldBeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TagRow_preserves_unedited_fields()
|
||||
{
|
||||
var original = new AbLegacyTagDefinition(
|
||||
"Level", "10.0.0.10", "N7:5", AbLegacyDataType.Int,
|
||||
Writable: true, WriteIdempotent: true);
|
||||
var row = AbLegacyDriverPage.AbLegacyTagRow.FromDefinition(original);
|
||||
row.Name = "Renamed";
|
||||
|
||||
var back = row.ToDefinition();
|
||||
back.Name.ShouldBe("Renamed");
|
||||
back.WriteIdempotent.ShouldBeTrue();
|
||||
}
|
||||
// v3 Batch-1 migration: the pre-declared Tags editor (AbLegacyDriverPage.AbLegacyTagRow +
|
||||
// AbLegacyDriverOptions.Tags) was retired — tags moved to the Raw tree (/raw, Batch 2). The former
|
||||
// TagRow_* / ValidateTagRow_* tests and the tag leg of the list-serialization test were removed.
|
||||
// The multi-device Devices editor is RETAINED, so its coverage (DeviceRow_* + ValidateDeviceRow_*
|
||||
// + the device-list serialization below, all carrying the AbLegacyPlcFamily enum) stays.
|
||||
|
||||
[Fact]
|
||||
public void ValidateDeviceRow_rejects_duplicate_host()
|
||||
@@ -155,32 +118,19 @@ public sealed class AbLegacyDriverPageFormSerializationTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ValidateTagRow_rejects_duplicate_name()
|
||||
{
|
||||
var rows = new List<AbLegacyDriverPage.AbLegacyTagRow> { new() { Name = "Level" } };
|
||||
AbLegacyDriverPage.AbLegacyTagRow.ValidateRow(new() { Name = "Level" }, rows, null)
|
||||
.ShouldNotBeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Device_and_tag_lists_survive_options_serialize_round_trip()
|
||||
public void Device_list_survives_options_serialize_round_trip()
|
||||
{
|
||||
var devices = new List<AbLegacyDeviceOptions>
|
||||
{
|
||||
new("10.0.0.10", AbLegacyPlcFamily.Slc500, "PLC-1"),
|
||||
new("10.0.0.11", AbLegacyPlcFamily.MicroLogix, "PLC-2"),
|
||||
};
|
||||
var tags = new List<AbLegacyTagDefinition>
|
||||
{
|
||||
new("Level", "10.0.0.10", "N7:5", AbLegacyDataType.Int),
|
||||
new("Pump", "10.0.0.11", "B3:0/0", AbLegacyDataType.Bit),
|
||||
};
|
||||
var opts = new AbLegacyDriverPage.FormModel().ToOptions(devices, tags);
|
||||
var opts = new AbLegacyDriverPage.FormModel().ToOptions(devices);
|
||||
var json = JsonSerializer.Serialize(opts, TestJsonOpts);
|
||||
var back = JsonSerializer.Deserialize<AbLegacyDriverOptions>(json, TestJsonOpts)!;
|
||||
back.Devices.Count.ShouldBe(2);
|
||||
back.Devices[0].HostAddress.ShouldBe("10.0.0.10");
|
||||
back.Tags.Count.ShouldBe(2);
|
||||
back.Tags[0].Name.ShouldBe("Level");
|
||||
back.Devices[0].PlcFamily.ShouldBe(AbLegacyPlcFamily.Slc500);
|
||||
back.Devices[1].PlcFamily.ShouldBe(AbLegacyPlcFamily.MicroLogix);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user