Exemplo n.º 1
0
        public void When_receive_not_ok_response_from_post_then_throws_exception(HttpStatusCode status)
        {
            this._httpClient  = new HttpClient(this._httpMessageHandlerMock.Object);
            this._facetValues = new FacetValues(this._httpClient, BaseAddress);

            this.HttpMessageHandlerMock(null, status);

            Assert.Throws <HttpRequestException>(() => this._facetValues.GetFacetValues(new List <string>()));
        }
Exemplo n.º 2
0
        public void When_receive_ok_response_with_empty_content_from_post_then_returns_null()
        {
            this._httpClient  = new HttpClient(this._httpMessageHandlerMock.Object);
            this._facetValues = new FacetValues(this._httpClient, BaseAddress);

            this.HttpMessageHandlerMock(null, HttpStatusCode.OK);

            var result = this._facetValues.GetFacetValues(new List <string>());

            result.Should().BeEquivalentTo((List <FacetValues>)null);
        }
Exemplo n.º 3
0
        public void When_receive_ok_response_from_post_then_returns_result_correctly()
        {
            var values = new List <Models.MLAPI.Facet>
            {
                FacetBuilder.Build.Instance
            };

            this._httpClient  = new HttpClient(this._httpMessageHandlerMock.Object);
            this._facetValues = new FacetValues(this._httpClient, BaseAddress);

            this.HttpMessageHandlerMock(values, HttpStatusCode.OK);

            var result = this._facetValues.GetFacetValues(new List <string>());

            result.Should().BeEquivalentTo(values);
        }
Exemplo n.º 4
0
 public FacetsService(IFacetValues facetValues)
 {
     this._facetValues = facetValues;
 }