public async void GetGoogleSearchResults_ReturnsNullValue() { //Arrange SearchQueryDto searchQuery = new SearchQueryDto(); var items = await GetGoogleSearchResultFromFileAsync(); var distributedCacheMock = new Mock <IDistributedCache>(); var cacheProviderMock = new Mock <ISearchResultCacheProvider <SearchResult> >(); var googleSearchExecutor = new GoogleSearchExecutor(distributedCacheMock.Object, cacheProviderMock.Object); //Act var result = await googleSearchExecutor.ExecuteSearchAsync(searchQuery); //Assert Assert.Null(result); }
public async void GetGoogleSearchResults_ReturnsValue() { //Arrange SearchQueryDto searchQuery = new SearchQueryDto(); var items = await GetGoogleSearchResultFromFileAsync(); var distributedCacheMock = new Mock <IDistributedCache>(); var cacheProviderMock = new Mock <ISearchResultCacheProvider <SearchResult> >(); cacheProviderMock.Setup(m => m.GetOrCreate(It.IsAny <string>(), It.IsAny <Func <SearchResult> >())).Returns(Task.FromResult(items)); var googleSearchExecutor = new GoogleSearchExecutor(distributedCacheMock.Object, cacheProviderMock.Object); //Act var result = await googleSearchExecutor.ExecuteSearchAsync(searchQuery); //Assert Assert.NotNull(result); }