Skip to content

Commit

Permalink
Fix unit tests errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
randy-armstrong committed Feb 5, 2021
1 parent c22ecec commit e016a9b
Show file tree
Hide file tree
Showing 6 changed files with 191 additions and 143 deletions.
17 changes: 15 additions & 2 deletions Stack/Opc.Ua.Core/Schema/UANodeSetHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ public void Export(ISystemContext context, NodeState node, bool outputRedundantN
exportedNode.Description = new LocalizedText[0];
}

exportedNode.Documentation = node.NodeSetDocumentation;
exportedNode.Category = (node.Categories != null && node.Categories.Count > 0) ? new List<string>(node.Categories).ToArray() : null;
exportedNode.ReleaseStatus = node.ReleaseStatus;
exportedNode.WriteMask = (uint)node.WriteMask;
Expand Down Expand Up @@ -624,6 +625,7 @@ private NodeState Import(ISystemContext context, UANode node)
}

importedNode.Description = Import(node.Description);
importedNode.NodeSetDocumentation = node.Documentation;
importedNode.Categories = (node.Category != null && node.Category.Length > 0) ? node.Category : null;
importedNode.ReleaseStatus = node.ReleaseStatus;
importedNode.WriteMask = (AttributeWriteMask)node.WriteMask;
Expand Down Expand Up @@ -909,8 +911,10 @@ private string Export(Opc.Ua.QualifiedName source, NamespaceTable namespaceUris)
{
List<Opc.Ua.Export.DataTypeField> fields = new List<DataTypeField>();

foreach (StructureField field in structureDefinition.Fields)
for (int ii = structureDefinition.FirstExplicitFieldIndex; ii < structureDefinition.Fields.Count; ii++)
{
StructureField field = structureDefinition.Fields[ii];

Opc.Ua.Export.DataTypeField output = new Opc.Ua.Export.DataTypeField();

output.Name = field.Name;
Expand Down Expand Up @@ -948,7 +952,16 @@ private string Export(Opc.Ua.QualifiedName source, NamespaceTable namespaceUris)
Opc.Ua.Export.DataTypeField output = new Opc.Ua.Export.DataTypeField();

output.Name = field.Name;
output.DisplayName = Export(new Opc.Ua.LocalizedText[] { field.Name });

if (field.DisplayName != null && output.Name != field.DisplayName.Text)
{
output.DisplayName = Export(new Opc.Ua.LocalizedText[] { field.DisplayName });
}
else
{
output.DisplayName = new LocalizedText[0];
}

output.Description = Export(new Opc.Ua.LocalizedText[] { field.Description });
output.ValueRank = ValueRanks.Scalar;
output.Value = (int)field.Value;
Expand Down

0 comments on commit e016a9b

Please sign in to comment.