public void Remove_EmptyTree_Throws() { var tree = new AaTree <int>(); Action act = () => tree.Remove(999); act.Should().Throw <InvalidOperationException>(); }
public void Remove_KeyNotInTree_Throws() { var tree = new AaTree <int>(); tree.AddRange(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); Action act = () => tree.Remove(999); act.Should().Throw <InvalidOperationException>(); }
public void Remove_MultipleKeys_TreeStillValid() { var tree = new AaTree <int>(); tree.AddRange(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); Remove(4).Should().NotThrow(); tree.Contains(4).Should().BeFalse(); tree.Count.Should().Be(9); Remove(8).Should().NotThrow(); tree.Contains(8).Should().BeFalse(); tree.Count.Should().Be(8); Remove(1).Should().NotThrow(); tree.Contains(1).Should().BeFalse(); tree.Count.Should().Be(7); Validate(tree.Root); Action Remove(int x) => () => tree.Remove(x); }