Exemplo n.º 1
0
        public void CopyTo()
        {
            var tree = new TTree <int>(2, 2);

            tree.Add(5);
            tree.Add(3);
            tree.Add(10);
            tree.Add(1);
            tree.Add(7);
            tree.Add(20);
            tree.Add(100);

            var items = new int[7];

            tree.CopyTo(items, 0);

            Assert.AreEqual(1, items[0], "Invalid value at 0");
            Assert.AreEqual(3, items[1], "Invalid value at 1");
            Assert.AreEqual(5, items[2], "Invalid value at 2");
            Assert.AreEqual(7, items[3], "Invalid value at 3");
            Assert.AreEqual(10, items[4], "Invalid value at 4");
            Assert.AreEqual(20, items[5], "Invalid value at 5");
            Assert.AreEqual(100, items[6], "Invalid value at 6");
        }