public async Task ReturnsSearchResults() { var searchTerm = " json "; var result = await Target.SearchAsync(searchTerm, CurrentUser); Assert.Equal("json", result.SearchTerm); Assert.True(result.OldSuccess, "The old search should have succeeded."); Assert.Equal(OldSearchResults.Hits, result.OldHits); var oldA = Assert.Single(result.OldItems); Assert.Equal("1.0.0", oldA.Version); Assert.True(result.NewSuccess, "The new search should have succeeded."); Assert.Equal(NewSearchResults.Hits, result.NewHits); Assert.Equal(2, result.NewItems.Count); Assert.Equal("2.0.0", result.NewItems[0].Version); Assert.Equal("3.0.0", result.NewItems[1].Version); Assert.Equal("*****@*****.**", result.EmailAddress); OldSearchService.Verify(x => x.Search(It.IsAny <SearchFilter>()), Times.Once); NewSearchService.Verify(x => x.Search(It.IsAny <SearchFilter>()), Times.Once); TelemetryService.Verify(x => x.TrackSearchSideBySide("json", true, 1, true, 2), Times.Once); AssertSearchFilters(result.SearchTerm); }
public async Task ReturnsEmptyModelWithNoSearchTerm(string searchTerm) { var result = await Target.SearchAsync(searchTerm, CurrentUser); Assert.Equal(string.Empty, result.SearchTerm); Assert.Equal("*****@*****.**", result.EmailAddress); OldSearchService.Verify(x => x.Search(It.IsAny <SearchFilter>()), Times.Never); NewSearchService.Verify(x => x.Search(It.IsAny <SearchFilter>()), Times.Never); TelemetryService.Verify( x => x.TrackSearchSideBySide(It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <int>(), It.IsAny <bool>(), It.IsAny <int>()), Times.Never); }