From e5e428b24f6c820638dce2ad2d483404b90ff8ea Mon Sep 17 00:00:00 2001 From: mpostol Date: Tue, 23 Feb 2021 10:41:57 +0100 Subject: [PATCH] Add a warning that the AS contains nodes orphaned and inaccessible for browsing starting from the Root node #529 -Prototyping with that - working on an algorithm to compare nodes in UANodesSet and ModelDesign. - UT :+1: --- .../XMLModelsProblemsToReportUnitTest.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/SemanticData/Tests/USNodeSetValidationUnitTestProject/XMLModelsProblemsToReportUnitTest.cs b/SemanticData/Tests/USNodeSetValidationUnitTestProject/XMLModelsProblemsToReportUnitTest.cs index 51f54fc1..a3d98645 100644 --- a/SemanticData/Tests/USNodeSetValidationUnitTestProject/XMLModelsProblemsToReportUnitTest.cs +++ b/SemanticData/Tests/USNodeSetValidationUnitTestProject/XMLModelsProblemsToReportUnitTest.cs @@ -68,7 +68,7 @@ public void eoursel510Test() addressSpace.ValidateAndExportModel(model); Assert.AreEqual(5, traceContext.TraceList.Count); IEnumerable nodes = testingModelFixture.Export(); - Assert.AreEqual(21, nodes.Count< NodeFactoryBase>()); + Assert.AreEqual(21, nodes.Count()); Dictionary nodesDictionary = nodes.ToDictionary(x => x.SymbolicName.Name); AddressSpaceContext asContext = addressSpace as AddressSpaceContext; //TODO Add a warning that the AS contains nodes orphaned and inaccessible for browsing starting from the Root node #529 @@ -76,17 +76,21 @@ public void eoursel510Test() asContext.UTValidateAndExportModel(1, x => allNodes = x); Assert.IsNotNull(allNodes); List orphanedNodes = new List(); + List processedNodes = new List(); foreach (IUANodeContext item in allNodes) { - if (!nodesDictionary.ContainsKey(item.BrowseName.ToString())) + if (!nodesDictionary.ContainsKey(item.BrowseName.Name)) { orphanedNodes.Add(item); Debug.WriteLine($"The following node has been removed from the model: {item.ToString()}"); } + else + processedNodes.Add(item); } - Debug.WriteLine($"The recovered information model contains {nodes.Count()} nodes"); + Debug.WriteLine($"The recovered information model contains {nodesDictionary.Count} nodes"); Debug.WriteLine($"The source information model contains {allNodes.Count()} nodes"); - Debug.WriteLine($"Number of nodes not considered for export {orphanedNodes.Count()}"); + Debug.WriteLine($"Number of nodes not considered for export {orphanedNodes.Count}"); + Debug.WriteLine($"Number of processed nodes {processedNodes.Count}"); } }