test: verify SDK 2 driver boundaries and lifecycle contracts

This commit is contained in:
Joseph Doherty
2026-11-10 10:21:53 -05:00
parent c6ce30121c
commit 47b66caa8d
18 changed files with 411 additions and 124 deletions
@@ -76,9 +76,9 @@ public sealed class OpcUaClientAlarmTests
// ---- #619: v3 RawPath <-> upstream-source translation on the native-alarm path ----
private static VariantCollection EventFields(string sourceNode, string conditionNode) =>
private static List<Variant> EventFields(string sourceNode, string conditionNode) =>
[
new Variant(new byte[] { 1 }), // EventId
Variant.From(new byte[] { 1 }.ToByteString()), // scalar ByteString EventId
new Variant(new NodeId("TripAlarmType", 3)), // EventType
new Variant(NodeId.Parse(sourceNode)), // SourceNode
new Variant(new LocalizedText("tripped")), // Message
@@ -310,18 +310,18 @@ public sealed class OpcUaClientAlarmTests
}
}
private static VariantCollection ConditionFields(
private static List<Variant> ConditionFields(
bool active, bool acked, string message = "tripped", ushort severity = 700, byte[]? eventId = null,
NodeId? branchId = null, NodeId? eventType = null)
{
var f = EventFields("ns=3;s=Alarms.Trip1", "ns=3;s=Alarms.Trip1.Cond");
f[0] = new Variant(eventId ?? new byte[] { 1 });
if (eventType is not null) f[1] = new Variant(eventType);
f[0] = Variant.From(new ByteString((eventId ?? new byte[] { 1 }).AsMemory()));
if (eventType is not null) f[1] = Variant.From(eventType.Value);
f[3] = new Variant(new LocalizedText(message));
f[4] = new Variant(severity);
f.Add(new Variant(active));
f.Add(new Variant(acked));
f.Add(branchId is null ? Variant.Null : new Variant(branchId));
f.Add(branchId is null ? Variant.Null : Variant.From(branchId.Value));
return f;
}
@@ -382,7 +382,7 @@ public sealed class OpcUaClientAlarmTests
OpcUaClientDriver.IsRefreshRequired(EventFieldsOfType(ObjectTypeIds.RefreshEndEventType)).ShouldBeFalse();
}
private static VariantCollection EventFieldsOfType(NodeId type)
private static List<Variant> EventFieldsOfType(NodeId type)
{
var f = EventFields("i=2253", "i=0");
f[1] = new Variant(type);