Exemple #1
0
        public void DeletionForEmptyElemsTest()
        {
            var n = new ObjectNode();

            n.RemoveElement("a");

            Assert.AreEqual(null, n.Elems);
        }
Exemple #2
0
        public void ElementsModificationTest()
        {
            var n = new ObjectNode();

            Assert.AreEqual(null, n.Elems);

            // Addition
            n.AddElement("a", new IntegerNode(42));
            n.AddElement("b", new StringNode("test"));

            Assert.AreEqual(2, n.Elems.Count);

            Assert.AreEqual(new IntegerNode(42), n.Elems["a"]);
            Assert.AreEqual(new StringNode("test"), n.Elems["b"]);

            // Deletion
            n.RemoveElement("a");
            n.RemoveElement("b");
            n.RemoveElement("c"); // Do not fail if removes non-existing keys

            Assert.AreEqual(0, n.Elems.Count);
        }