test: migrate SDK 2.0 wire contracts and pin baseline aggregate vectors

This commit is contained in:
Joseph Doherty
2026-11-10 10:44:23 -05:00
parent 6aaccb332f
commit aac7c88417
29 changed files with 4695 additions and 362 deletions
@@ -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));
}
}