feat(dcl): add OpcUaReferenceForm.IsDurable — flags bare ns= bindings (v3 cutover #14)
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
using ZB.MOM.WW.ScadaBridge.Commons.Types.DataConnections;
|
||||
|
||||
namespace ZB.MOM.WW.ScadaBridge.Commons.Tests.Types.DataConnections;
|
||||
|
||||
public class OpcUaReferenceFormTests
|
||||
{
|
||||
[Theory]
|
||||
// durable → true
|
||||
[InlineData("nsu=https://zb.com/otopcua/raw;s=Line1.Pump.Speed", true)]
|
||||
[InlineData("nsu=https://zb.com/otopcua/uns;s=AreaA/Line1/Pump/Speed", true)]
|
||||
[InlineData("NSU=https://x;s=y", true)] // case-insensitive prefix
|
||||
[InlineData("ns=0;i=85", true)] // spec-fixed namespace 0
|
||||
[InlineData("i=85", true)] // short form, implicit ns0
|
||||
[InlineData("s=Devices.Pump1", true)] // no namespace prefix
|
||||
[InlineData("", true)] // nothing typed
|
||||
[InlineData(" ", true)]
|
||||
[InlineData(null, true)]
|
||||
// bare server-namespace index → false (warn)
|
||||
[InlineData("ns=2;s=MyDevice.Temperature", false)]
|
||||
[InlineData("ns=1;i=1001", false)]
|
||||
[InlineData("ns=10;s=x", false)]
|
||||
[InlineData(" ns=3;s=x ", false)] // trimmed before inspection
|
||||
public void IsDurable_classifies_reference_forms(string? reference, bool expected)
|
||||
{
|
||||
Assert.Equal(expected, OpcUaReferenceForm.IsDurable(reference));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user