Example #1
0
        public void ConstructorNodeIdTest()
        {
            Mock <IAddressSpaceBuildContext> _addressSpaceMock = new Mock <IAddressSpaceBuildContext>();
            UANodeContext _toTest = new UANodeContext(NodeId.Parse("ns=1;i=11"), _addressSpaceMock.Object);

            Assert.IsNotNull(_toTest.BrowseName);
            Assert.IsTrue(new QualifiedName() == _toTest.BrowseName);
            Assert.IsFalse(_toTest.InRecursionChain);
            Assert.IsFalse(_toTest.IsProperty);
            Assert.IsFalse(((IUANodeBase)_toTest).IsPropertyVariableType);
            Assert.IsFalse(_toTest.ModelingRule.HasValue);
            Assert.IsNotNull(_toTest.NodeIdContext);
            Assert.IsTrue(_toTest.NodeIdContext.ToString() == "ns=1;i=11");
            Assert.IsNull(_toTest.UANode);
            XML.UANode _node = UnitTest.Helpers.TestData.CreateUAObject();
            int        _registerReferenceCounter = 0;

            _toTest.Update(_node, x => _registerReferenceCounter++);
            Assert.AreEqual <int>(2, _registerReferenceCounter);
            Assert.IsNotNull(_toTest.BrowseName);
            Assert.AreEqual <QualifiedName>(new QualifiedName("NewUAObject", 1), _toTest.BrowseName);
            Assert.IsFalse(_toTest.InRecursionChain);
            Assert.IsFalse(_toTest.IsProperty);
            Assert.IsFalse(((IUANodeBase)_toTest).IsPropertyVariableType);
            Assert.IsFalse(_toTest.ModelingRule.HasValue);
            Assert.IsNotNull(_toTest.NodeIdContext);
            Assert.AreEqual <string>(_toTest.NodeIdContext.ToString(), "ns=1;i=11");
            Assert.IsNotNull(_toTest.UANode);
        }
Example #2
0
 internal static string NodeIdentifier(this XML.UANode node)
 {
     if (string.IsNullOrEmpty(node.BrowseName))
     {
         return(node.SymbolicName);
     }
     return(node.BrowseName);
 }
Example #3
0
        /// <summary>
        /// Indicates whether the the inherited parent object is also equal to another object.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns><c>true</c> if the current object is equal to the <paramref name="other">other</paramref>; otherwise,, <c>false</c> otherwise.</returns>
        protected override bool ParentEquals(UANode other)
        {
            UAMethod _other = other as UAMethod;

            if (Object.ReferenceEquals(_other, null))
            {
                return(false);
            }
            return
                (base.ParentEquals(_other) &&
                 // TODO compare ArgumentDescription
                 this.Executable == _other.Executable &&
                 this.UserExecutable == _other.UserExecutable);
            // not exposed and must be excluded from the comparison this.MethodDeclarationId == _other.MethodDeclarationId;
        }
 private void ImportUANode(UANode node, UAModelContext modelContext, Action<TraceMessage> traceEvent)
 {
     try
       {
     if (node == null)
       m_TraceEvent(TraceMessage.BuildErrorTraceMessage(BuildError.NodeCannotBeNull, "At Importing UANode."));
     NodeId nodeId = modelContext.ImportNodeId(node.NodeId, false, m_TraceEvent);
     UANodeContext _newNode = null;
     string nodeIdKey = nodeId.ToString();
     if (!m_NodesDictionary.TryGetValue(nodeIdKey, out _newNode))
     {
       _newNode = new UANodeContext(this, modelContext, nodeId);
       _newNode.Update(node, traceEvent);
       m_NodesDictionary.Add(nodeIdKey, _newNode);
     }
     else
     {
       if (_newNode.UANode != null)
     m_TraceEvent(TraceMessage.BuildErrorTraceMessage(BuildError.NodeIdDuplicated, String.Format("The {0} is already defined.", node.NodeId.ToString())));
       _newNode.Update(node, traceEvent);
     }
     foreach (Reference _rf in node.References)
     {
       UAReferenceContext _rs = UAReferenceContext.NewReferenceStub(_rf, this, modelContext, _newNode, m_TraceEvent);
       if (!m_References.ContainsKey(_rs.Key))
     m_References.Add(_rs.Key, _rs);
     }
       }
       catch (Exception _ex)
       {
     string _msg = String.Format("ImportUANode {1} is interrupted by exception {0}", _ex.Message, node.NodeId);
     m_TraceEvent(TraceMessage.DiagnosticTraceMessage(_msg));
       }
 }
Example #5
0
 /// <summary>
 /// Indicates whether the the inherited parent object is also equal to another object.
 /// </summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns><c>true</c> if the current object is equal to the <paramref name="other">other</paramref>; otherwise,, <c>false</c> otherwise.</returns>
 /// <exception cref="NotImplementedException">Intentionally not implemented</exception>
 protected override bool ParentEquals(UANode other)
 {
     throw new NotImplementedException("Intentionally not implemented");
 }