Beispiel #1
0
        public void When_receive_ok_response_from_q_post_then_return_result_correctly(string query)
        {
            this._httpMessageHandler.Protected()
            .Setup <Task <HttpResponseMessage> >("SendAsync", ItExpr.IsAny <HttpRequestMessage>(), ItExpr.IsAny <CancellationToken>())
            .Returns(Task.FromResult(new HttpResponseMessage
            {
                StatusCode = System.Net.HttpStatusCode.OK,
                Content    = this.GetStringContent()
            }));

            this._httpClient = new HttpClient(this._httpMessageHandler.Object);
            IIndexSearch indexSearchOK = new IndexSearch(null, this._numberOfResults, this._httpClient, "https://localhost:5000", null);

            indexSearchOK.QSearch(query, new List <Facet>()).Result.Should().BeEquivalentTo(this.GetSearchResult());
        }