示例#1
0
        public void CreateUAModelContextNodeAliasNull()
        {
            UANodeSet _tm = TestData.CreateNodeSetModel();

            _tm.Aliases = null;
            IAddressSpaceBuildContext _as = new AddressSpaceFixture();
            UAModelContext            _mc = new UAModelContext(_tm, _as);
        }
示例#2
0
        public void ExportBrowseNameTest()
        {
            UANodeSet _tm = TestData.CreateNodeSetModel();
            IAddressSpaceBuildContext _as           = new AddressSpaceFixture();
            UAModelContext            _mc           = new UAModelContext(_tm, _as);
            XmlQualifiedName          _resolvedName = _mc.ExportBrowseName(null, null);

            Assert.IsNull(_resolvedName);
            _resolvedName = _mc.ExportBrowseName(null, UAInformationModel.DataTypes.BaseDataType);
            Assert.IsNull(_resolvedName);
            _resolvedName = _mc.ExportBrowseName(new NodeId(UAInformationModel.DataTypes.BaseDataType, 0).ToString(), UAInformationModel.DataTypes.BaseDataType);
            Assert.IsNull(_resolvedName);
            _resolvedName = _mc.ExportBrowseName(new NodeId(UAInformationModel.DataTypes.Structure, 0).ToString(), UAInformationModel.DataTypes.BaseDataType);
            Assert.IsNotNull(_resolvedName);
            Assert.AreEqual(@"http://opcfoundation.org/UA/:Structure", _resolvedName.ToString());
        }
示例#3
0
        public void ImportNodeIdTest()
        {
            List <TraceMessage> _log = new List <TraceMessage>();

            BuildErrorsHandling.Log.TraceEventAction += _msg => _log.Add(_msg);
            UANodeSet           _tm        = TestData.CreateNodeSetModel();
            AddressSpaceFixture _as        = new AddressSpaceFixture();
            UAModelContext      _mc        = new UAModelContext(_tm, _as);
            List <NodeId>       nodeIdList = new List <NodeId>();

            foreach (UANode _nd in _tm.Items)
            {
                nodeIdList.Add(_mc.ImportNodeId(_nd.NodeId, false));
            }
            BuildErrorsHandling.Log.TraceEventAction -= _msg => _log.Add(_msg);
            Assert.AreEqual <int>(0, _log.Count);
            Assert.AreEqual <int>(1, nodeIdList.Count);
            Assert.AreEqual <int>(0, _as.m_NamespaceTable.GetIndex(Namespaces.OpcUa));
            Assert.AreEqual <int>(1, _as.m_NamespaceTable.GetIndex(@"http://cas.eu/UA/Demo/"));
        }
示例#4
0
        public void CreateUAModelContextModelNamespaceUrisNullTest()
        {
            List <TraceMessage> _log = new List <TraceMessage>();

            BuildErrorsHandling.Log.TraceEventAction += _msg => _log.Add(_msg);
            UANodeSet _tm = TestData.CreateNodeSetModel();

            _tm.NamespaceUris = null;
            AddressSpaceFixture _as        = new AddressSpaceFixture();
            UAModelContext      _mc        = new UAModelContext(_tm, _as);
            List <NodeId>       nodeIdList = new List <NodeId>();

            foreach (UANode _nd in _tm.Items)
            {
                nodeIdList.Add(_mc.ImportNodeId(_nd.NodeId, false));
            }
            BuildErrorsHandling.Log.TraceEventAction -= _msg => _log.Add(_msg);
            Assert.AreEqual <int>(1, _log.Count);
            Assert.AreEqual <string>("P3-0802020000", _log[0].BuildError.Identifier);
            Assert.AreEqual <int>(1, nodeIdList.Count);
            Assert.AreEqual <int>(0, _as.m_NamespaceTable.GetIndex(Namespaces.OpcUa));
            Assert.AreEqual <int>(-1, _as.m_NamespaceTable.GetIndex(@"NameUnknown0"));
        }
示例#5
0
 public void ConstructorTest()
 {
     UANodeSet _tm = TestData.CreateNodeSetModel();
     IAddressSpaceBuildContext _as = new AddressSpaceFixture();
     UAModelContext            _mc = new UAModelContext(_tm, _as);
 }