test: repair SDK status oracle and remove duplicate payload cases

This commit is contained in:
Joseph Doherty
2026-11-10 12:50:19 -05:00
parent ef8c2d1919
commit b9a03b4274
2 changed files with 14 additions and 5 deletions
@@ -11,8 +11,8 @@ public class VariantBoundaryTests
{
foreach (var value in new object?[] { null, true, (sbyte)-1, (byte)1, (short)-2, (ushort)2,
-3, 3u, -4L, 4UL, 1.25f, 2.5, "", "text", Guid.Parse("de305d54-75b4-431b-adb2-eb6b9e546014"),
new DateTime(2026, 11, 10, 0, 0, 0, DateTimeKind.Utc), Array.Empty<byte>(), new byte[] { 1, 2 },
Array.Empty<int>(), new[] { 1 }, new[] { 1, 2 }, Array.Empty<string>(), new[] { "", "text" } })
new DateTime(2026, 11, 10, 0, 0, 0, DateTimeKind.Utc), new byte[] { 1, 2 },
new[] { 1 }, new[] { 1, 2 }, new[] { "", "text" } })
yield return [value];
foreach (var value in new object[] { true, (sbyte)-1, (byte)1, (short)-2, (ushort)2,
-3, 3u, -4L, 4UL, 1.25f, 2.5, "text", Guid.Empty,
@@ -47,9 +47,18 @@ public sealed class StatusCodeParityTests
/// <summary>Every <c>Opc.Ua.StatusCodes</c> member, by name — the oracle this test checks against.</summary>
private static readonly IReadOnlyDictionary<string, uint> SdkStatusCodes =
typeof(Opc.Ua.StatusCodes)
.GetProperties(BindingFlags.Public | BindingFlags.Static)
.Where(p => p.PropertyType == typeof(Opc.Ua.StatusCode))
.ToDictionary(p => p.Name, p => ((Opc.Ua.StatusCode)p.GetValue(null)!).Code, StringComparer.Ordinal);
.GetFields(BindingFlags.Public | BindingFlags.Static)
.Where(f => f.FieldType == typeof(Opc.Ua.StatusCode))
.ToDictionary(f => f.Name, f => ((Opc.Ua.StatusCode)f.GetValue(null)!).Code, StringComparer.Ordinal);
[Fact]
public void SDK_oracle_contains_all_status_severities()
{
SdkStatusCodes.Count.ShouldBeGreaterThan(200);
SdkStatusCodes["Good"].ShouldBe(0u);
SdkStatusCodes["Uncertain"].ShouldBe(0x40000000u);
SdkStatusCodes["Bad"].ShouldBe(0x80000000u);
}
/// <summary>
/// Every status-shaped <c>const uint</c> declared anywhere in the deployed driver assemblies, as