Esempio n. 1
0
        public void FirstSearch_Test_whenValueExist()
        {
            //arrange

            int[] exampleArray = { 6, 9, 52, -20, 100 };
            int   ValueToFind  = -20;

            //act

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

            //assert

            Assert.AreEqual(returnedIndex, 0);
        }
Esempio n. 2
0
        public void FirstSearch_Test_valueExists_array_of_same_values()
        {
            //arrange

            int[] exampleArray = { 100, 100, 100, 100, 100 };

            int ValueToFind = 100;
            //act

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

            //assert


            Assert.AreEqual(returnedIndex, 2);
        }
Esempio n. 3
0
        public void FirstSearch_Test_valueExists_another_boundary()
        {
            //arrange

            int[] exampleArray = { 6, 9, 52, -20, 100 };

            int ValueToFind = 100;
            //act

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

            //assert


            Assert.AreEqual(returnedIndex, 4);
        }