Merge fix/816-opcuaclient-cert-host
This commit is contained in:
+25
@@ -180,6 +180,31 @@ public sealed class OpcUaClientDriverPageFormSerializationTests
|
||||
def.DiscoveryUrl.ShouldBeNull();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// #816: the server host-name check is tri-state. Unset must stay unset through the form (so a later change of
|
||||
/// the driver default reaches configs nobody chose for), and an explicit opt-in / NAT opt-out must survive.
|
||||
/// </summary>
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData(true)]
|
||||
[InlineData(false)]
|
||||
public void FormModel_RoundTrip_PreservesHostNameValidationTriState(bool? value)
|
||||
{
|
||||
var formOpts = new JsonSerializerOptions(_opts) { Converters = { new JsonStringEnumConverter() } };
|
||||
var original = new OpcUaClientDriverOptions
|
||||
{
|
||||
CertificateValidation = new OpcUaCertificateValidationOptions { ValidateServerHostName = value },
|
||||
};
|
||||
|
||||
var back = OpcUaClientDriverForm.OpcUaClientFormModel.FromRecord(original).ToRecord([]);
|
||||
back.CertificateValidation.ValidateServerHostName.ShouldBe(value);
|
||||
|
||||
var reparsed = JsonSerializer.Deserialize<OpcUaClientDriverOptions>(
|
||||
JsonSerializer.Serialize(back, formOpts), formOpts)!;
|
||||
reparsed.CertificateValidation.ValidateServerHostName.ShouldBe(value);
|
||||
reparsed.CertificateValidation.EffectiveValidateServerHostName.ShouldBe(value ?? false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// #648: stored DriverConfig JSON from before <c>targetNamespaceKind</c>/<c>unsMappingTable</c> were removed
|
||||
/// must still load into the form (the form's options use <c>UnmappedMemberHandling.Skip</c>) and the legacy
|
||||
|
||||
Reference in New Issue
Block a user