fix(otopcua): guard root-level discovered var parent + tighten mapper
This commit is contained in:
@@ -63,6 +63,36 @@ public sealed class DiscoveredNodeMapperTests
|
||||
}, ignoreOrder: true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Empty_input_yields_empty_plan()
|
||||
{
|
||||
var result = DiscoveredNodeMapper.Map("EQ-1", Array.Empty<DiscoveredNode>(), authoredRefs: new HashSet<string>());
|
||||
result.Folders.ShouldBeEmpty();
|
||||
result.Variables.ShouldBeEmpty();
|
||||
result.RoutingByRef.ShouldBeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Array_metadata_passes_through_unchanged()
|
||||
{
|
||||
var node = new DiscoveredNode(
|
||||
FolderPathSegments: ["FOCAS", "10.0.0.5:8193", "Axes"],
|
||||
BrowseName: "Positions",
|
||||
DisplayName: "Positions",
|
||||
FullReference: "10.0.0.5:8193/Axes/Positions",
|
||||
DataType: DriverDataType.Float64,
|
||||
IsArray: true,
|
||||
ArrayDim: 8u,
|
||||
Writable: false,
|
||||
IsHistorized: false);
|
||||
|
||||
var result = DiscoveredNodeMapper.Map("EQ-1", new[] { node }, authoredRefs: new HashSet<string>());
|
||||
|
||||
result.Variables.ShouldHaveSingleItem();
|
||||
result.Variables[0].IsArray.ShouldBeTrue();
|
||||
result.Variables[0].ArrayLength.ShouldBe(8u);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
// Mirror OtOpcUaNodeManager.ResolveBuiltInDataType's accepted string set: Float32 -> "Float",
|
||||
// Float64 -> "Double", Reference (Galaxy attr ref encoded as a string) -> "String". The pass-through
|
||||
|
||||
Reference in New Issue
Block a user