fix(adminui): S7 typed page no longer wipes Tags on save

- S7DriverPage.FormModel now preserves Tags through Form ↔ Options
  translation (was hard-coding Tags = [] on every save, silently
  destroying any tag list that operators had configured).
- Add FormModel_RoundTrip tests for OpcUaClient and Historian
  mirror classes — both were translating Options ↔ form-model
  entirely untested.
- Surface S7 Tags in the round-trip test so this regression
  can't reach merge again.
This commit is contained in:
Joseph Doherty
2026-05-28 10:06:43 -04:00
parent a971db3ee5
commit c4086c243c
4 changed files with 124 additions and 2 deletions
@@ -2,6 +2,7 @@ using System.Text.Json;
using System.Text.Json.Serialization;
using Shouldly;
using Xunit;
using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Clusters.Drivers;
using ZB.MOM.WW.OtOpcUa.Driver.Historian.Wonderware.Client;
namespace ZB.MOM.WW.OtOpcUa.AdminUI.Tests;
@@ -80,4 +81,32 @@ public sealed class HistorianWonderwareDriverPageFormSerializationTests
back.ProbeTimeoutSeconds.ShouldBe(20);
back.PipeName.ShouldBe("otopcua-historian");
}
[Fact]
public void FormModel_RoundTrip_PreservesAllFields()
{
// Construct a record with non-default values for every property and verify
// that WonderwareHistorianClientFormModel.FromRecord → ToRecord is lossless.
var original = new WonderwareHistorianClientOptions(
PipeName: "otopcua-historian-prod",
SharedSecret: "sup3rs3cr3t",
PeerName: "OtOpcUa-Redundant",
ConnectTimeout: TimeSpan.FromSeconds(18),
CallTimeout: TimeSpan.FromSeconds(45))
{
ProbeTimeoutSeconds = 30,
};
var form = HistorianWonderwareDriverPage.WonderwareHistorianClientFormModel.FromRecord(original);
var result = form.ToRecord();
result.PipeName.ShouldBe("otopcua-historian-prod");
result.SharedSecret.ShouldBe("sup3rs3cr3t");
result.PeerName.ShouldBe("OtOpcUa-Redundant");
result.ConnectTimeout.ShouldBe(TimeSpan.FromSeconds(18));
result.CallTimeout.ShouldBe(TimeSpan.FromSeconds(45));
result.EffectiveConnectTimeout.ShouldBe(TimeSpan.FromSeconds(18));
result.EffectiveCallTimeout.ShouldBe(TimeSpan.FromSeconds(45));
result.ProbeTimeoutSeconds.ShouldBe(30);
}
}