public void GetMin_NonEmptyTree_ReturnsCorrectAnswer() { var tree = new AaTree <int>(); tree.AddRange(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); tree.GetMin().Should().Be(1); }
public void Constructor_UseCustomComparer_FormsCorrectTree() { var tree = new AaTree <int>(Comparer <int> .Create((x, y) => y.CompareTo(x))); tree.AddRange(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); tree.GetMax().Should().Be(1); tree.GetMin().Should().Be(10); tree.GetKeysInOrder().SequenceEqual(new[] { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }).Should().BeTrue(); Validate(tree.Root); }
public void GetMin_EmptyTree_ThrowsCorrectException() { var tree = new AaTree <int>(); Assert.Throws <InvalidOperationException>(() => tree.GetMin()); }