public void FindSecondLargest() { BinarySearchTree tree = new BinarySearchTree(); tree.Add(new Node { Value = 10 }); tree.Add(new Node { Value = 5 }); tree.Add(new Node { Value = 15 }); tree.Add(new Node { Value = 4 }); tree.Add(new Node { Value = 13 }); int result = tree.FindSecondLargest(); Assert.AreEqual(13, result); }
public void ThrowsExceptionWhenRootNotSet() { BinarySearchTree tree = new BinarySearchTree(); Assert.Throws(typeof(InvalidOperationException), () => tree.FindSecondLargest()); }