Ejemplo n.º 1
0
        public void Order()
        {
            var sortedTree = new SortedTree <int, String>();

            sortedTree.Visit(1, 3).Set("ing");
            sortedTree.Visit(1, 1).Set("Pa");
            sortedTree.Visit(1, 2).Set("ss");

            var           singleNode = sortedTree.Next();
            StringBuilder nodeValues = new StringBuilder();

            while (singleNode != null)
            {
                nodeValues.Append(singleNode.Value);
                singleNode = singleNode.Next();
            }

            Assert.AreEqual("Passing", nodeValues.ToString());
        }
Ejemplo n.º 2
0
        public void OrderWithMoveWithReplace()
        {
            var sortedTree = new SortedTree <int, String>();

            sortedTree.Visit(1, 1).Set("Pa");
            sortedTree.Visit(1, 3).Set("ing");
            sortedTree.Visit(1, 2).Set("REPLACENODE");
            sortedTree.Visit(1, 2, 3).Set("REPLACECHILD");
            sortedTree.Visit(2).Set("ss");

            sortedTree.Visit(2).MoveTo(sortedTree.Visit(1), true);
            var           singleNode = sortedTree.Next();
            StringBuilder nodeValues = new StringBuilder();

            while (singleNode != null)
            {
                nodeValues.Append(singleNode.Value);
                singleNode = singleNode.Next();
            }

            Assert.AreEqual("Passing", nodeValues.ToString());
        }