예제 #1
0
        public void BinarySearch_LinearSearch_Results_AreSame()
        {
            //Arrange
            var randomWords   = new DownloadWords();
            var selectedWords = new Program().SelectWords(randomWords).Take(1);

            //Act
            var search = new TypesOfSearches.Searches();

            foreach (var word in selectedWords)
            {
                //Assert
                Assert.AreSame(search.BinarySearch(word), search.LinearSearch(word));
            }
        }
예제 #2
0
        public void IfLinearSearch_CantFindAMatch_ItsReturnValue_IsNull()
        {
            //Arrange
            var randomWords   = new DownloadWords();
            var selectedWords = new Program().SelectWords(randomWords).Take(1);

            //Act
            var search = new TypesOfSearches.Searches();

            foreach (var word in selectedWords)
            {
                word.RandomWord = "BeastModeBarry";
                //Assert
                Assert.IsNull(search.LinearSearch(word));
            }
        }