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
-61
@@ -43,10 +43,6 @@ public sealed class AbCipDriverPageFormSerializationTests
|
||||
[
|
||||
new AbCipDeviceOptions("ab://10.0.0.1/1,0", AbCipPlcFamily.ControlLogix, "PLC-1"),
|
||||
],
|
||||
Tags =
|
||||
[
|
||||
new AbCipTagDefinition("Speed", "ab://10.0.0.1/1,0", "Motor1.Speed", AbCipDataType.Real, Writable: true),
|
||||
],
|
||||
};
|
||||
|
||||
var json = JsonSerializer.Serialize(original, _opts);
|
||||
@@ -66,9 +62,6 @@ public sealed class AbCipDriverPageFormSerializationTests
|
||||
back.Devices.Count.ShouldBe(1);
|
||||
back.Devices[0].HostAddress.ShouldBe("ab://10.0.0.1/1,0");
|
||||
back.Devices[0].PlcFamily.ShouldBe(AbCipPlcFamily.ControlLogix);
|
||||
back.Tags.Count.ShouldBe(1);
|
||||
back.Tags[0].Name.ShouldBe("Speed");
|
||||
back.Tags[0].DataType.ShouldBe(AbCipDataType.Real);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -116,43 +109,11 @@ public sealed class AbCipDriverPageFormSerializationTests
|
||||
back.ConnectionSize.ShouldBe(4002);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TagRow_round_trips_through_definition()
|
||||
{
|
||||
var row = new AbCipDriverPage.AbCipTagRow
|
||||
{
|
||||
Name = "Speed", DeviceHostAddress = "ab://10.0.0.1/1,0", TagPath = "Motor1.Speed",
|
||||
DataType = AbCipDataType.Real, Writable = true,
|
||||
};
|
||||
var def = row.ToDefinition();
|
||||
var back = AbCipDriverPage.AbCipTagRow.FromDefinition(def);
|
||||
|
||||
back.Name.ShouldBe("Speed");
|
||||
back.DeviceHostAddress.ShouldBe("ab://10.0.0.1/1,0");
|
||||
back.TagPath.ShouldBe("Motor1.Speed");
|
||||
back.DataType.ShouldBe(AbCipDataType.Real);
|
||||
back.Writable.ShouldBeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TagRow_preserves_unedited_fields()
|
||||
{
|
||||
var original = new AbCipTagDefinition(
|
||||
"Speed", "ab://10.0.0.1/1,0", "Motor1.Speed", AbCipDataType.Structure,
|
||||
Writable: true, WriteIdempotent: true,
|
||||
Members: [new AbCipStructureMember("Sub", AbCipDataType.DInt)],
|
||||
SafetyTag: true);
|
||||
var row = AbCipDriverPage.AbCipTagRow.FromDefinition(original);
|
||||
row.Name = "Renamed";
|
||||
|
||||
var back = row.ToDefinition();
|
||||
back.Name.ShouldBe("Renamed");
|
||||
back.WriteIdempotent.ShouldBeTrue();
|
||||
back.SafetyTag.ShouldBeTrue();
|
||||
back.Members.ShouldNotBeNull();
|
||||
back.Members!.Count.ShouldBe(1);
|
||||
back.Members[0].Name.ShouldBe("Sub");
|
||||
}
|
||||
// v3 Batch-1 migration: the pre-declared Tags editor (AbCipDriverPage.AbCipTagRow +
|
||||
// AbCipDriverOptions.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 AbCipPlcFamily enum) stays.
|
||||
|
||||
[Fact]
|
||||
public void ValidateDeviceRow_rejects_duplicate_host()
|
||||
@@ -163,32 +124,19 @@ public sealed class AbCipDriverPageFormSerializationTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ValidateTagRow_rejects_duplicate_name()
|
||||
{
|
||||
var rows = new List<AbCipDriverPage.AbCipTagRow> { new() { Name = "Speed" } };
|
||||
AbCipDriverPage.AbCipTagRow.ValidateRow(new() { Name = "Speed" }, 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<AbCipDeviceOptions>
|
||||
{
|
||||
new("ab://10.0.0.1/1,0", AbCipPlcFamily.ControlLogix, "PLC-1"),
|
||||
new("ab://10.0.0.2/1,0", AbCipPlcFamily.CompactLogix, "PLC-2"),
|
||||
};
|
||||
var tags = new List<AbCipTagDefinition>
|
||||
{
|
||||
new("Speed", "ab://10.0.0.1/1,0", "Motor1.Speed", AbCipDataType.Real),
|
||||
new("Run", "ab://10.0.0.2/1,0", "Motor2.Run", AbCipDataType.Bool),
|
||||
};
|
||||
var opts = new AbCipDriverPage.FormModel().ToOptions(devices, tags);
|
||||
var opts = new AbCipDriverPage.FormModel().ToOptions(devices);
|
||||
var json = JsonSerializer.Serialize(opts, TestJsonOpts);
|
||||
var back = JsonSerializer.Deserialize<AbCipDriverOptions>(json, TestJsonOpts)!;
|
||||
back.Devices.Count.ShouldBe(2);
|
||||
back.Devices[0].HostAddress.ShouldBe("ab://10.0.0.1/1,0");
|
||||
back.Tags.Count.ShouldBe(2);
|
||||
back.Tags[0].Name.ShouldBe("Speed");
|
||||
back.Devices[0].PlcFamily.ShouldBe(AbCipPlcFamily.ControlLogix);
|
||||
back.Devices[1].PlcFamily.ShouldBe(AbCipPlcFamily.CompactLogix);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user