public void When_receive_not_ok_response_from_post_then_throws_exception(HttpStatusCode status) { this._httpClient = new HttpClient(this._httpMessageHandlerMock.Object); this._documentFacets = new DocumentFacets(this._httpClient, BaseAddress); this.HttpMessageHandlerMock(null, status); Assert.Throws <HttpRequestException>(() => this._documentFacets.GetQuestions(new List <string>())); }
public void When_receive_ok_response_with_empty_content_from_post_then_returns_null() { this._httpClient = new HttpClient(this._httpMessageHandlerMock.Object); this._documentFacets = new DocumentFacets(this._httpClient, BaseAddress); this.HttpMessageHandlerMock(null, HttpStatusCode.OK); var result = this._documentFacets.GetQuestions(new List <string>()); result.Should().BeEquivalentTo((List <Question>)null); }
public SuggestionsService( IIndexSearch indexSearch, INlpCall nlpCall, IDocumentFacets documentFacets, IFilterDocuments filterDocuments, List <string> irrelevantIntents) { this._indexSearch = indexSearch; this._nlpCall = nlpCall; this._documentFacets = documentFacets; this._filterDocuments = filterDocuments; this._irrelevantIntents = irrelevantIntents ?? new List <string>(); }
public void When_receive_ok_response_from_post_then_returns_result_correctly() { var questions = new List <FacetQuestionResult> { FacetQuestionResultBuilder.Build.Instance }; this._httpClient = new HttpClient(this._httpMessageHandlerMock.Object); this._documentFacets = new DocumentFacets(this._httpClient, BaseAddress); this.HttpMessageHandlerMock(questions, HttpStatusCode.OK); var result = this._documentFacets.GetQuestions(new List <string>()); result.Should().BeEquivalentTo(questions); }
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; }