Exemplo n.º 1
0
 internal static Tuple <OpcUaModelCompiler.ModelDesign, string> Import(string path, Action <TraceMessage> traceEvent)
 {
     try
     {
         using (OpenFileDialog _ofd = new OpenFileDialog()
         {
             CheckFileExists = true,
             FileName = path,
             Filter = Resources.NodeSet_FileDialogFilter,
             DefaultExt = Resources.NodeSet_FileDialogDefaultExt,
             Title = Resources.NodeSet_FileDialogTitle
         })
         {
             if (_ofd.ShowDialog() != DialogResult.OK)
             {
                 return(null);
             }
             Application.UseWaitCursor = true;
             FileInfo _fileInfo = new FileInfo(_ofd.FileName);
             Debug.Assert(_fileInfo.Exists);
             traceEvent(TraceMessage.DiagnosticTraceMessage($"Importing information model from the NodeSet file {_fileInfo.Name}"));
             return(new Tuple <OpcUaModelCompiler.ModelDesign, string>(ImportUANodeSet.Import(_fileInfo, traceEvent), _fileInfo.Name));
         }
     }
     catch (Exception _ex)
     {
         ExceptionHandling(_ex, traceEvent);
     }
     finally
     {
         Application.UseWaitCursor = false;
     }
     return(null);
 }
Exemplo n.º 2
0
        public void WrongFileNFormatTestMethod()
        {
            FileInfo _testDataFileInfo = new FileInfo(@"Models\ReferenceTest\ReferenceTest.NodeSet.xml");

            Assert.IsTrue(_testDataFileInfo.Exists);
            List <TraceMessage> _trace     = new List <TraceMessage>();
            int         _diagnosticCounter = 0;
            ModelDesign _actual            = ImportUANodeSet.Import(_testDataFileInfo, z => TraceDiagnostic(z, _trace, ref _diagnosticCounter));
        }
Exemplo n.º 3
0
        public void FileNotFoundTestMethod()
        {
            FileInfo _testDataFileInfo = new FileInfo(@"sajlajsjljjjjk.sasa.sasa.sasa");

            Assert.IsFalse(_testDataFileInfo.Exists);
            List <TraceMessage> _trace     = new List <TraceMessage>();
            int         _diagnosticCounter = 0;
            ModelDesign _actual            = ImportUANodeSet.Import(_testDataFileInfo, z => TraceDiagnostic(z, _trace, ref _diagnosticCounter));
        }
Exemplo n.º 4
0
        public void UAReferenceTestMethod()
        {
            FileInfo _testDataFileInfo = new FileInfo(@"Models\ReferenceTest\ReferenceTest.NodeSet2.xml");

            Assert.IsTrue(_testDataFileInfo.Exists);
            ModelDesign         _refData   = XmlFile.ReadXmlFile <ModelDesign>(@"Models\ReferenceTest.xml");
            List <TraceMessage> _trace     = new List <TraceMessage>();
            int         _diagnosticCounter = 0;
            ModelDesign _actual            = ImportUANodeSet.Import(_testDataFileInfo, z => TraceDiagnostic(z, _trace, ref _diagnosticCounter));

            Assert.AreEqual <int>(0, _trace.Where <TraceMessage>(x => x.BuildError.Focus != Focus.Diagnostic).Count <TraceMessage>());
            Assert.Inconclusive("UAOOI.SemanticData.UANodeSetValidation 5.1.0 is available #120");
            Assert.IsNotNull(_actual);
            //Compare(_refData, _actual);
            //Assert.IsTrue(_refData.Items[0] is ReferenceTypeDesign);
            //Compare((ReferenceTypeDesign)_refData.Items[0], (ReferenceTypeDesign)_actual.Items[0]);
        }