Пример #1
0
        public void FirstChildNextSibling_1_Constructor_2_ToStringReturnsProperResult()
        {
            // Arrange
            IFirstChildNextSibling <string> tree = DSBuilder.CreateFirstChildNextSibling_Empty();
            string expected = "NIL";

            // Act
            string actual = tree.ToString();

            Assert.AreEqual(expected, actual);
        }
Пример #2
0
        public void FirstChildNextSibling_1_Constructor_1_SizeReturnsProperResult()
        {
            // Arrange
            IFirstChildNextSibling <string> tree = DSBuilder.CreateFirstChildNextSibling_Empty();
            int expected = 0;

            // Act
            int actual = tree.Size();

            Assert.AreEqual(expected, actual);
        }
Пример #3
0
        static void Opgave2()
        {
            System.Console.WriteLine("\n=====   Opgave 2 : FirstChildNextSibling   =====\n");

            IFirstChildNextSibling <string> tree;

            // Empty tree
            tree = DSBuilder.CreateFirstChildNextSibling_Empty();
            tree.PrintPreOrder();
            System.Console.WriteLine("Size: {0}", tree.Size());
            System.Console.WriteLine(tree);

            // Small tree
            tree = DSBuilder.CreateFirstChildNextSibling_Small();
            tree.PrintPreOrder();
            System.Console.WriteLine("Size: {0}", tree.Size());
            System.Console.WriteLine(tree);

            // Tree from figure 18.3
            tree = DSBuilder.CreateFirstChildNextSibling_18_3();
            tree.PrintPreOrder();
            System.Console.WriteLine("Size: {0}", tree.Size());
            System.Console.WriteLine(tree);
        }