Beispiel #1
0
        public void WhenCalling_Height_WithInitialization_ShouldReturnHeight(IList <int?> tree, int height)
        {
            // Arrange
            var bt   = new Data_Structure_Implementation.BinaryTree.BinaryTree(tree);
            var root = bt.Root;

            // Act

            // Assert
            Assert.True(height == bt.Height(root));
        }
Beispiel #2
0
        public void WhenCalling_BinaryTree_ForDefaultConstructor_ShouldReturnNull()
        {
            // Arrange
            var tree = new Data_Structure_Implementation.BinaryTree.BinaryTree();

            // Act
            var root = tree.Root;

            // Assert
            Assert.True(root == null);
        }
Beispiel #3
0
        public void WhenCalling_InorderIterative_ShouldReturnInorderList(IList <int?> tree, IList <int> expected)
        {
            // Arrange
            var bt   = new Data_Structure_Implementation.BinaryTree.BinaryTree(tree);
            var root = bt.Root;

            // Act
            var list = bt.Inorder_Iterative(root);

            // Assert
            Assert.True(IsSame(list, expected));
        }