示例#1
0
        public void SecondSearch_Test_valueExists_anotheBoundary()
        {
            //arrange
            int[] exampleArray = { 6, 9, 52, -20, 100 };
            int   ValueToFind  = 52;
            //act

            int returnedIndex = SortAndSearch.SecondSearch(exampleArray, ValueToFind);

            //assert

            Assert.AreEqual(returnedIndex, 3);
        }
示例#2
0
        public void SecondSearch_Test_valueExists_array_with_same_values()
        {
            //arrange
            int[] exampleArray = { 100, 100, 100, 100, 100 };
            int   ValueToFind  = 100;
            //act

            int returnedIndex = SortAndSearch.SecondSearch(exampleArray, ValueToFind);

            //assert

            Assert.AreEqual(returnedIndex, 0);
        }
示例#3
0
        public void SecondSearch_Test_valueExists_and_its_first_index()
        {
            //arrange
            int[] exampleArray = { 6, 9, 52, -20, 100 };

            int thirdValueToFind = -20;
            //act

            int returnedIndex3 = SortAndSearch.SecondSearch(exampleArray, thirdValueToFind);

            //assert

            Assert.AreEqual(returnedIndex3, 0, "Index algorithm = " + returnedIndex3);
        }
示例#4
0
        public void SecondSearch_Test_valueNotExists()
        {
            //arrange
            int[] exampleArray = { 6, 9, 52, -20, 100 };
            int   ValueToFind  = 0;

            //act

            int returnedIndex = SortAndSearch.SecondSearch(exampleArray, ValueToFind);

            //assert

            Assert.AreEqual(returnedIndex, -1);
        }