test: migrate SDK 2.0 wire contracts and pin baseline aggregate vectors
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using Opc.Ua;
|
||||
|
||||
namespace ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests;
|
||||
|
||||
/// <summary>Observes wire payloads using the CLR representations asserted by the baseline contract tests.</summary>
|
||||
internal static class SdkTestValues
|
||||
{
|
||||
internal static object? ClrValue(this DataValue value) => value.WrappedValue.ClrValue();
|
||||
internal static object? ClrValue(this Variant value) => value.AsBoxedObject(Variant.BoxingBehavior.Legacy) switch
|
||||
{
|
||||
ByteString bytes => bytes.IsNull ? null : bytes.ToArray(),
|
||||
DateTimeUtc time => (DateTime)time,
|
||||
Uuid id => (Guid)id,
|
||||
var other => other,
|
||||
};
|
||||
|
||||
internal static Variant FromClr(object? value)
|
||||
{
|
||||
if (value is null) return Variant.Null;
|
||||
if (value is byte[] bytes) return Variant.From(ByteString.From(bytes));
|
||||
if (VariantHelper.TryCastFrom(value, out var variant)) return variant;
|
||||
throw new ArgumentException("Unsupported test payload.", nameof(value));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user