public void Inorder_ExpectedPoints() { // arrange Point[] expected = new Point[] { new Point(0, 0), new Point(1, 1), new Point(2, 2), new Point(3, 3) }; UserBinarySearchTree <Point> tree = new UserBinarySearchTree <Point>(new Point(0, 0), new CoordinatesBasedComparer()); for (int i = 1; i < expected.Length; i++) { tree.AddNode(expected[i]); } // act int index = 0; foreach (var item in tree.Inorder()) { // assert Assert.AreEqual(expected[index], item); index++; } }
public void Inorder_ExpectedStrings() { UserBinarySearchTree <string> tree = new UserBinarySearchTree <string>("0"); List <string> expected = new List <string>(); expected.Add("0"); for (int i = 1; i < 10; i++) { tree.AddNode(i.ToString()); expected.Add(i.ToString()); } int index = 0; foreach (var item in tree.Inorder()) { // assert Assert.AreEqual(expected[index], item); index++; } }