示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }