diff --git a/tests/Client/ZB.MOM.WW.OtOpcUa.Client.Shared.Tests/OpcUaClientServiceTests.cs b/tests/Client/ZB.MOM.WW.OtOpcUa.Client.Shared.Tests/OpcUaClientServiceTests.cs index 820d30b4..631c8668 100644 --- a/tests/Client/ZB.MOM.WW.OtOpcUa.Client.Shared.Tests/OpcUaClientServiceTests.cs +++ b/tests/Client/ZB.MOM.WW.OtOpcUa.Client.Shared.Tests/OpcUaClientServiceTests.cs @@ -1191,6 +1191,7 @@ public class OpcUaClientServiceTests : IDisposable result.ShouldBe(StatusCodes.Good); session.CallMethodCount.ShouldBe(1); + session.CallMethodObjectIds[0].ShouldBe(NodeId.Parse("ns=2;s=Cond.Condition")); session.CallMethodMethodIds[0].ShouldBe(MethodIds.ConditionType_Enable); session.CallMethodInputArgs[0].ShouldBeEmpty(); } @@ -1210,10 +1211,31 @@ public class OpcUaClientServiceTests : IDisposable result.ShouldBe(StatusCodes.Good); session.CallMethodCount.ShouldBe(1); + session.CallMethodObjectIds[0].ShouldBe(NodeId.Parse("ns=2;s=Cond.Condition")); session.CallMethodMethodIds[0].ShouldBe(MethodIds.ConditionType_Disable); session.CallMethodInputArgs[0].ShouldBeEmpty(); } + /// + /// Verifies the ".Condition" suffix is appended when the caller supplies the source node, + /// but left alone when the caller already passes the condition node — mirrors + /// for the Enable path so the + /// object-node derivation in CallEnableDisableAsync is regression-covered. + /// + [Fact] + public async Task EnableAsync_WhenConditionSuffixAlreadyPresent_DoesNotDoubleSuffix() + { + var session = new FakeSessionAdapter(); + _sessionFactory.EnqueueSession(session); + await _service.ConnectAsync(ValidSettings()); + + var result = await _service.EnableAsync("ns=2;s=Cond.Condition"); + + result.ShouldBe(StatusCodes.Good); + session.CallMethodCount.ShouldBe(1); + session.CallMethodObjectIds[0].ShouldBe(NodeId.Parse("ns=2;s=Cond.Condition")); + } + /// /// Verifies that a from the session is captured and /// returned as a bad rather than propagating to the caller.