test: validate grpc data connections with local docker and opcua cli
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using Opc.Ua;
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
using ZB.MOM.WW.OtOpcUa.Client.Shared.Adapters;
|
||||
|
||||
namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Tests;
|
||||
|
||||
[Trait("Feature", "GrpcData"), Trait("Phase", "P10")]
|
||||
public class ReadResultValidationTests
|
||||
{
|
||||
[Fact]
|
||||
public void ValidateReadResult_RejectsMissingOrExtraResultsAndBadStatus()
|
||||
{
|
||||
var header = new ResponseHeader { ServiceResult = StatusCodes.Good };
|
||||
var node = new NodeId("tag", 2);
|
||||
Should.Throw<ServiceResultException>(() => DefaultSessionAdapter.ValidateReadResult(header, [], node));
|
||||
Should.Throw<ServiceResultException>(() => DefaultSessionAdapter.ValidateReadResult(header,
|
||||
[new DataValue(), new DataValue()], node));
|
||||
var error = Should.Throw<ServiceResultException>(() => DefaultSessionAdapter.ValidateReadResult(header,
|
||||
[new DataValue(new Variant(0), StatusCodes.BadNodeIdUnknown)], node));
|
||||
error.StatusCode.ShouldBe(StatusCodes.BadNodeIdUnknown);
|
||||
Should.Throw<ServiceResultException>(() => DefaultSessionAdapter.ValidateReadResult(
|
||||
new ResponseHeader { ServiceResult = StatusCodes.BadUnexpectedError }, [new DataValue()], node));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user