public void When_receive_ok_response_with_empty_content_from_post_then_returns_null() { this._httpClient = new HttpClient(this._httpMessageHandlerMock.Object); this._lastClickAnalytics = new LastClickAnalytics(this._httpClient, BaseAddress); this.HttpMessageHandlerMock(null, HttpStatusCode.OK); var result = this._lastClickAnalytics.GetLastClickAnalyticsResults(new HashSet <string>()).Result; result.Should().BeEquivalentTo((List <LastClickAnalyticsResult>)null); }
public void When_receive_not_ok_response_from_post_then_throws_exception(HttpStatusCode status) { this._httpClient = new HttpClient(this._httpMessageHandlerMock.Object); this._lastClickAnalytics = new LastClickAnalytics(this._httpClient, BaseAddress); this.HttpMessageHandlerMock(null, status); try { var result = this._lastClickAnalytics.GetLastClickAnalyticsResults(new HashSet <string>()).Result; Assert.Fail(); } catch (Exception) { } }
public void When_receive_ok_response_from_post_then_returns_result_correctly() { var lastClickAnalyticsResults = new List <LastClickAnalyticsResult> { LastClickAnalyticsResultsBuilder.Build.Instance }; this._httpClient = new HttpClient(this._httpMessageHandlerMock.Object); this._lastClickAnalytics = new LastClickAnalytics(this._httpClient, BaseAddress); this.HttpMessageHandlerMock(lastClickAnalyticsResults, HttpStatusCode.OK); var result = this._lastClickAnalytics.GetLastClickAnalyticsResults(new HashSet <string>()).Result; result.Should().BeEquivalentTo(lastClickAnalyticsResults); }
public SuggestionsService( IIndexSearch indexSearch, ILastClickAnalytics lastClickAnalytics, IDocumentFacets documentFacets, INearestDocuments nearestDocuments, IFilterDocuments filterDocuments, int numberOfWordsIntoQ, double minimumConfidence, RecommenderSettings recommenderSettings) { this._indexSearch = indexSearch; this._lastClickAnalytics = lastClickAnalytics; this._documentFacets = documentFacets; this._nearestDocuments = nearestDocuments; this._filterDocuments = filterDocuments; this._numberOfWordsIntoQ = numberOfWordsIntoQ; this._minimumConfidence = minimumConfidence; this._recommenderSettings = recommenderSettings; }