public void LeftSubTree_NonEmpty_IsEqualToConstructionArgument() { var subtree = BinaryTree.Create(0); var tree = BinaryTree.Create(subtree, BinaryTree <int> .Empty, 0); Assert.That(tree.LeftSubTree, Is.EqualTo(subtree)); }
public void Create_SubTreesAreEmpty() { var tree = BinaryTree.Create(0); Assert.That(tree.LeftSubTree.IsEmpty, Is.True); Assert.That(tree.RightSubTree.IsEmpty, Is.True); }
public void ForEachPostOrder_SmallTree_ActionIsCalledWithElementsInOrder() { var tree = BinaryTree.Create(BinaryTree.Create(2), BinaryTree.Create(3), 1); var list = new List <int>(); tree.ForEachPostOrder(list.Add); Assert.That(list, Is.EqualTo(new[] { 2, 3, 1 })); }
public void LeftSubTree_EmptySubTree_IsEmpty() { var tree = BinaryTree.Create(0); Assert.That(tree.LeftSubTree.IsEmpty, Is.True); }
public void Any_NonEmpty_IsTrue() { var tree = BinaryTree.Create(0); Assert.That(tree.Any, Is.True); }
public void IsEmpty_NonEmpty_IsFalse() { var tree = BinaryTree.Create(0); Assert.That(tree.IsEmpty, Is.False); }
public void Create_RootValueContainsElement() { var tree = BinaryTree.Create(42); Assert.That(tree.RootValue, Is.EqualTo(42)); }
public void RootValue_NonEmpty_IsRootElement() { var tree = BinaryTree.Create(42); Assert.That(tree.RootValue, Is.EqualTo(42)); }