fix: preserve SDK 2.0 client value and lifetime contracts

This commit is contained in:
Joseph Doherty
2026-11-10 10:19:42 -05:00
parent 0ecea3c6be
commit 3ca06e1b87
38 changed files with 591 additions and 186 deletions
@@ -117,7 +117,7 @@ public class EndpointSelectorTests
var best = EndpointSelector.SelectBest(endpoints, "opc.tcp://external-host:4840",
MessageSecurityMode.Sign);
new Uri(best.EndpointUrl).Host.ShouldBe("external-host");
new Uri(best.EndpointUrl.ShouldNotBeNull()).Host.ShouldBe("external-host");
}
/// <summary>
@@ -169,7 +169,7 @@ public class EndpointSelectorTests
var best = EndpointSelector.SelectBest(endpoints, "opc.tcp://localhost:4841", MessageSecurityMode.None);
var uri = new Uri(best.EndpointUrl);
var uri = new Uri(best.EndpointUrl.ShouldNotBeNull());
uri.Host.ShouldBe("localhost");
uri.Port.ShouldBe(4841);
uri.AbsolutePath.ShouldBe("/OtOpcUa");
@@ -183,8 +183,8 @@ public class EndpointSelectorTests
var best = EndpointSelector.SelectBest(endpoints, "opc.tcp://localhost:4841", MessageSecurityMode.None);
new Uri(best.EndpointUrl).Host.ShouldBe("internal-host");
new Uri(best.EndpointUrl).Port.ShouldBe(4843);
new Uri(best.EndpointUrl.ShouldNotBeNull()).Host.ShouldBe("internal-host");
new Uri(best.EndpointUrl.ShouldNotBeNull()).Port.ShouldBe(4843);
}
/// <summary>Identical host, port and scheme: nothing to rewrite.</summary>
@@ -206,7 +206,7 @@ public class EndpointSelectorTests
var best = EndpointSelector.SelectBest(endpoints, "opc.tcp://localhost", MessageSecurityMode.None);
var uri = new Uri(best.EndpointUrl);
var uri = new Uri(best.EndpointUrl.ShouldNotBeNull());
uri.Host.ShouldBe("localhost");
uri.Port.ShouldBe(4840);
}
@@ -219,7 +219,7 @@ public class EndpointSelectorTests
var best = EndpointSelector.SelectBest(endpoints, "opc.tcp://[::1]:4841", MessageSecurityMode.None);
var uri = new Uri(best.EndpointUrl);
var uri = new Uri(best.EndpointUrl.ShouldNotBeNull());
uri.Host.ShouldBe("[::1]");
uri.Port.ShouldBe(4841);
}