public void OnUnsortedArray_returnsNotFound() { int[] input = new int[] { 3, 1, 2, 4, 5 }; IBinarySearch search = new MyBinarySearch(); int result = search.Find(input, 3); Assert.AreEqual(-1, result); }
public void OnSortedArray_findsIndexOfValue() { int[] input = new int[] { 1, 2, 3, 4, 5 }; IBinarySearch search = new MyBinarySearch(); int result = search.Find(input, 3); Assert.AreEqual(2, result); }
public void OnValueNotInArray_returnsNotFound() { int[] input = new int[] { 1, 2, 3, 4, 5 }; IBinarySearch search = new MyBinarySearch(); int result = search.Find(input, 6); Assert.AreEqual(-1, result); }