예제 #1
0
        public void CannotSearchMSNSearchWhenNoConnection()
        {
            //Arrange
            var fakeHttpHandler = new HttpHandlerMockConnectionProblem();
            var msnSearch       = new MSNSearch(fakeHttpHandler);

            //Act
            var searchResult = msnSearch.Search("java");

            //Assert
        }
예제 #2
0
        public void CannotReturnSearchResultsFromMSNSearchWhenResponseFailed()
        {
            //Arrange
            var fakeHttpHandler = new HttpHandlerMockFailedResponse();
            var msnSearch       = new MSNSearch(fakeHttpHandler);

            //Act
            var searchResult = msnSearch.Search(".net");

            //Assert
        }
예제 #3
0
        public void CannotSearchMSNSearchWhenTimeOut()
        {
            //Arrange
            var fakeHttpHandler = new HttpHandlerMockTimeOut();
            var msnSearch       = new MSNSearch(fakeHttpHandler);

            //Act
            var searchResult = msnSearch.Search("java");

            //Assert
        }
예제 #4
0
        public void SearchingMSNSearchReturnsValidSearchResult()
        {
            //Arrange
            var fakeHttpHandler = new HttpHandlerMockMSNSearch();
            var msnSearch       = new MSNSearch(fakeHttpHandler);

            //Act
            var searchResult = msnSearch.Search("java");

            //Assert
            Assert.AreEqual("java", searchResult.SearchTerm);
            Assert.AreEqual(13300000, searchResult.NumberOfResults);
            Assert.AreEqual("MSN Search", searchResult.SearchEngineUsed);
        }