Beispiel #1
0
        public void Node_SetNodeAttribute_SetsNodeAttribute()
        {
            // given:
            var node     = new Node("Node");
            var nullattr = new Null("nullattr");

            // require:
            Assert.AreEqual(0, node.GetSrcObjectCount());
            Assert.AreEqual(0, node.GetDstObjectCount());
            Assert.AreEqual(0, node.GetSrcPropertyCount());
            Assert.AreEqual(0, node.GetDstPropertyCount());
            Assert.AreEqual(0, node.GetNodeAttributeCount());
            Assert.AreEqual(null, node.GetNodeAttribute());
            Assert.AreEqual(-1, node.GetDefaultNodeAttributeIndex());

            Assert.AreEqual(0, nullattr.GetSrcObjectCount());
            Assert.AreEqual(0, nullattr.GetDstObjectCount());
            Assert.AreEqual(0, nullattr.GetSrcPropertyCount());
            Assert.AreEqual(0, nullattr.GetDstPropertyCount());
            Assert.AreEqual(0, nullattr.GetNodeCount());

            // when:
            node.SetNodeAttribute(nullattr);

            // then:
            Assert.AreEqual(1, node.GetSrcObjectCount());
            Assert.AreEqual(nullattr, node.GetSrcObject(0));
            Assert.AreEqual(0, node.GetDstObjectCount());
            Assert.AreEqual(0, node.GetSrcPropertyCount());
            Assert.AreEqual(0, node.GetDstPropertyCount());
            Assert.AreEqual(1, node.GetNodeAttributeCount());
            Assert.AreEqual(nullattr, node.GetNodeAttribute());
            Assert.AreEqual(0, node.GetDefaultNodeAttributeIndex());
            Assert.AreEqual(nullattr, node.GetNodeAttributeByIndex(0));

            Assert.AreEqual(0, nullattr.GetSrcObjectCount());
            Assert.AreEqual(1, nullattr.GetDstObjectCount());
            Assert.AreEqual(node, nullattr.GetDstObject(0));
            Assert.AreEqual(0, nullattr.GetSrcPropertyCount());
            Assert.AreEqual(0, nullattr.GetDstPropertyCount());
            Assert.AreEqual(1, nullattr.GetNodeCount());
            Assert.AreEqual(node, nullattr.GetNode());
            Assert.AreEqual(node, nullattr.GetNode(0));
        }