-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ADI model from Embedded example import fails #509
- added test to investigate the problem.
- Loading branch information
Showing
2 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
SemanticData/Tests/USNodeSetValidationUnitTestProject/XMLModelsProblemsToReportUnitTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
//___________________________________________________________________________________ | ||
// | ||
// Copyright (C) 2021, Mariusz Postol LODZ POLAND. | ||
// | ||
// To be in touch join the community at GITTER: https://gitter.im/mpostol/OPC-UA-OOI | ||
//___________________________________________________________________________________ | ||
|
||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Linq; | ||
using UAOOI.SemanticData.BuildingErrorsHandling; | ||
|
||
namespace UAOOI.SemanticData.UANodeSetValidation | ||
{ | ||
[TestClass] | ||
[DeploymentItem(@"XMLModels\ProblemsToReport", @"ProblemsToReport\")] | ||
public class XMLModelsProblemsToReportUnitTest | ||
{ | ||
[TestMethod] | ||
public void ADITest() | ||
{ | ||
FileInfo _testDataFileInfo = new FileInfo(@"ProblemsToReport\ADI#509\Opc.Ua.Adi.NodeSet2.xml"); | ||
Assert.IsTrue(_testDataFileInfo.Exists); | ||
List<TraceMessage> _trace = new List<TraceMessage>(); | ||
IAddressSpaceContext _as = new AddressSpaceContext(z => _trace.Add(z)); | ||
_as.ImportUANodeSet(_testDataFileInfo); | ||
Assert.AreEqual<int>(0, _trace.Where<TraceMessage>(x => x.BuildError.Focus != Focus.Diagnostic).Count<TraceMessage>()); | ||
_as.ValidateAndExportModel(@"http://opcfoundation.org/UA/ADI/"); | ||
IEnumerable<TraceMessage> vitalMessageserrors = _trace.Where<TraceMessage>(x => x.BuildError.Focus != Focus.Diagnostic); | ||
IEnumerable<TraceMessage> focusNodeClass = _trace.Where<TraceMessage>(x => x.BuildError.Focus == Focus.NodeClass); | ||
Assert.IsFalse(focusNodeClass.Where<TraceMessage>(x => !x.BuildError.Identifier.Trim().Contains("P3-0502020001")).Any<TraceMessage>()); | ||
|
||
//Assert.Inconclusive("The import returns unexpected errors."); | ||
|
||
Assert.AreEqual<int>(5, vitalMessageserrors.Count<TraceMessage>()); | ||
|
||
Assert.AreEqual<int>(3, focusNodeClass.Count<TraceMessage>()); | ||
Debug.WriteLine(nameof(Focus.NodeClass)); | ||
foreach (TraceMessage item in focusNodeClass) | ||
Debug.WriteLine(item.ToString()); | ||
|
||
IEnumerable<TraceMessage> focusNonCategorized = _trace.Where<TraceMessage>(x => x.BuildError.Focus == Focus.NonCategorized); | ||
Assert.AreEqual<int>(2, focusNonCategorized.Count<TraceMessage>()); | ||
Debug.WriteLine(nameof(Focus.NonCategorized)); | ||
foreach (TraceMessage item in focusNonCategorized) | ||
Debug.WriteLine(item.ToString()); | ||
} | ||
} | ||
} |