c9bc358dc9
v2-ci / unit-tests (push) Has been cancelled
G9 ran on an isolated 2-node pair (otopcua-g9, 003c7f89, Mode unset as
deployed) with otopcua-cli as the owner-approved client: A1-A3, A5, A7, A8
(graceful, ~11 s gap), B2 (docker kill, failover <1 s, ~2 s gap, 0 Bad,
survivor 250 at +44 s) and B3 (no failback) pass; A4/A5b unmet under Unset,
met under Warm (#717). G8 (CTT) waived by the owner for GA; G5 is the only
open exit criterion.
The run found the CLI printing every array as System.String[] (ServerArray
unreadable); ValueFormatter now renders [a, b] / hex for read, subscribe and
historyread, with tests. Runbook A4/A5b text updated for the #717 modes.
Evidence: docs/plans/evidence/2026-11-13-615-g9/RESULTS.md.
36 lines
1.6 KiB
C#
36 lines
1.6 KiB
C#
using Shouldly;
|
|
using Xunit;
|
|
using ZB.MOM.WW.OtOpcUa.Client.CLI.Helpers;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Client.CLI.Tests;
|
|
|
|
/// <summary>Array-valued nodes print their elements, not the CLR type name (#615 G9: <c>ServerArray</c> read as <c>System.String[]</c>).</summary>
|
|
public class ValueFormatterTests
|
|
{
|
|
/// <summary>A string array (e.g. ServerArray i=2254) prints its elements in order.</summary>
|
|
[Fact]
|
|
public void String_array_prints_elements() =>
|
|
ValueFormatter.Format(new[] { "urn:OtOpcUa:central-1", "urn:OtOpcUa:central-2" })
|
|
.ShouldBe("[urn:OtOpcUa:central-1, urn:OtOpcUa:central-2]");
|
|
|
|
/// <summary>An empty array prints as <c>[]</c>, distinguishable from a null value.</summary>
|
|
[Fact]
|
|
public void Empty_array_prints_brackets() => ValueFormatter.Format(Array.Empty<string>()).ShouldBe("[]");
|
|
|
|
/// <summary>Numeric arrays use the invariant culture.</summary>
|
|
[Fact]
|
|
public void Numeric_array_is_invariant() => ValueFormatter.Format(new[] { 1.5, 2.25 }).ShouldBe("[1.5, 2.25]");
|
|
|
|
/// <summary>A byte string prints as hex rather than a list of bytes.</summary>
|
|
[Fact]
|
|
public void Byte_string_prints_hex() => ValueFormatter.Format(new byte[] { 0x0A, 0xFF }).ShouldBe("0x0AFF");
|
|
|
|
/// <summary>A string is not treated as a collection of characters.</summary>
|
|
[Fact]
|
|
public void String_is_not_enumerated() => ValueFormatter.Format("abc").ShouldBe("abc");
|
|
|
|
/// <summary>Scalars and null keep their plain rendering.</summary>
|
|
[Fact]
|
|
public void Scalars_and_null() { ValueFormatter.Format(250).ShouldBe("250"); ValueFormatter.Format(null).ShouldBe(""); }
|
|
}
|