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:
+7
-65
@@ -31,7 +31,6 @@ public sealed class TwinCATDriverPageFormSerializationTests
|
||||
},
|
||||
ProbeTimeoutSeconds = 20,
|
||||
Devices = [],
|
||||
Tags = [],
|
||||
};
|
||||
|
||||
var json = JsonSerializer.Serialize(original, _opts);
|
||||
@@ -48,7 +47,6 @@ public sealed class TwinCATDriverPageFormSerializationTests
|
||||
back.Probe.Timeout.ShouldBe(TimeSpan.FromSeconds(3));
|
||||
back.ProbeTimeoutSeconds.ShouldBe(20);
|
||||
back.Devices.ShouldBeEmpty();
|
||||
back.Tags.ShouldBeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -84,7 +82,7 @@ public sealed class TwinCATDriverPageFormSerializationTests
|
||||
|
||||
var form = ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Clusters.Drivers
|
||||
.TwinCATDriverPage.FormModel.FromOptions(opts);
|
||||
var roundTripped = form.ToOptions([], []);
|
||||
var roundTripped = form.ToOptions([]);
|
||||
|
||||
roundTripped.Timeout.ShouldBe(TimeSpan.FromSeconds(3));
|
||||
roundTripped.UseNativeNotifications.ShouldBeTrue();
|
||||
@@ -140,69 +138,20 @@ public sealed class TwinCATDriverPageFormSerializationTests
|
||||
error.ShouldContain("Duplicate");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TagRow_RoundTrip_PreservesEditableFields()
|
||||
{
|
||||
var def = new TwinCATTagDefinition("Speed", "192.168.0.1.1.1:851", "MAIN.rSpeed", TwinCATDataType.Real, Writable: false);
|
||||
|
||||
var row = ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Clusters.Drivers
|
||||
.TwinCATDriverPage.TwinCATTagRow.FromDefinition(def);
|
||||
var back = row.ToDefinition();
|
||||
|
||||
back.Name.ShouldBe("Speed");
|
||||
back.DeviceHostAddress.ShouldBe("192.168.0.1.1.1:851");
|
||||
back.SymbolPath.ShouldBe("MAIN.rSpeed");
|
||||
back.DataType.ShouldBe(TwinCATDataType.Real);
|
||||
back.Writable.ShouldBeFalse();
|
||||
}
|
||||
// v3 Batch-1 migration: the pre-declared Tags editor (TwinCATDriverPage.TwinCATTagRow +
|
||||
// TwinCATDriverOptions.Tags) was retired — tags moved to the Raw tree (/raw, Batch 2). The former
|
||||
// TagRow_* tests and the tag leg of FormModel_ToOptions_* were removed. The multi-device Devices
|
||||
// editor is RETAINED, so its coverage (DeviceRow_* + the device-list serialization below) stays.
|
||||
|
||||
[Fact]
|
||||
public void TagRow_CarriesThroughUneditedWriteIdempotent()
|
||||
{
|
||||
// WriteIdempotent is not exposed by the editor; it must survive a load→edit→save via _source.
|
||||
var def = new TwinCATTagDefinition("Cmd", "192.168.0.1.1.1:851", "GVL.Start", TwinCATDataType.Bool,
|
||||
Writable: true, WriteIdempotent: true);
|
||||
|
||||
var row = ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Clusters.Drivers
|
||||
.TwinCATDriverPage.TwinCATTagRow.FromDefinition(def);
|
||||
row.Name = "CmdRenamed"; // touch an edited field
|
||||
var back = row.ToDefinition();
|
||||
|
||||
back.Name.ShouldBe("CmdRenamed");
|
||||
back.WriteIdempotent.ShouldBeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TagRow_ValidateRow_RejectsDuplicateName()
|
||||
{
|
||||
var existing = ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Clusters.Drivers
|
||||
.TwinCATDriverPage.TwinCATTagRow.FromDefinition(
|
||||
new TwinCATTagDefinition("Speed", "192.168.0.1.1.1:851", "MAIN.rSpeed", TwinCATDataType.Real));
|
||||
var dup = new ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Clusters.Drivers
|
||||
.TwinCATDriverPage.TwinCATTagRow { Name = "SPEED" }; // case-insensitive collision
|
||||
|
||||
var all = new[] { existing, dup };
|
||||
var error = ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Clusters.Drivers
|
||||
.TwinCATDriverPage.TwinCATTagRow.ValidateRow(dup, all, editIndex: 1);
|
||||
|
||||
error.ShouldNotBeNull();
|
||||
error.ShouldContain("Duplicate");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FormModel_ToOptions_SerializesDeviceAndTagLists()
|
||||
public void FormModel_ToOptions_SerializesDeviceList()
|
||||
{
|
||||
var form = ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Clusters.Drivers
|
||||
.TwinCATDriverPage.FormModel.FromOptions(new TwinCATDriverOptions());
|
||||
|
||||
var devices = new[] { new TwinCATDeviceOptions("192.168.0.1.1.1:851", "PLC1") };
|
||||
var tags = new[]
|
||||
{
|
||||
new TwinCATTagDefinition("Speed", "192.168.0.1.1.1:851", "MAIN.rSpeed", TwinCATDataType.Real,
|
||||
Writable: true, WriteIdempotent: true),
|
||||
};
|
||||
|
||||
var opts = form.ToOptions(devices, tags);
|
||||
var opts = form.ToOptions(devices);
|
||||
var json = JsonSerializer.Serialize(opts, _opts);
|
||||
var back = JsonSerializer.Deserialize<TwinCATDriverOptions>(json, _opts);
|
||||
|
||||
@@ -210,12 +159,5 @@ public sealed class TwinCATDriverPageFormSerializationTests
|
||||
back.Devices.Count.ShouldBe(1);
|
||||
back.Devices[0].HostAddress.ShouldBe("192.168.0.1.1.1:851");
|
||||
back.Devices[0].DeviceName.ShouldBe("PLC1");
|
||||
back.Tags.Count.ShouldBe(1);
|
||||
back.Tags[0].Name.ShouldBe("Speed");
|
||||
back.Tags[0].DeviceHostAddress.ShouldBe("192.168.0.1.1.1:851");
|
||||
back.Tags[0].SymbolPath.ShouldBe("MAIN.rSpeed");
|
||||
back.Tags[0].DataType.ShouldBe(TwinCATDataType.Real);
|
||||
back.Tags[0].Writable.ShouldBeTrue();
|
||||
back.Tags[0].WriteIdempotent.ShouldBeTrue();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user