public async Task GetAsync_InvalidJson_ThrowsException()
        {
            var factory           = _provider.GetService <IHttpClientFactory>();
            var clientHandlerStub = new DelegatingHandlerStub(new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent("{ssss:}")
            });
            var client = new HttpClient(clientHandlerStub);

            factory.CreateClient().Returns(client);

            var rest = _provider.GetService <IRestClient>();
            await Assert.ThrowsAsync <JsonException>(() => rest.GetAsync <object>(UrlSample));
        }
        public async Task GetAsync_NotOk_ThrowsException()
        {
            var factory           = _provider.GetService <IHttpClientFactory>();
            var clientHandlerStub = new DelegatingHandlerStub(new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.BadGateway,
                Content    = null
            });
            var client = new HttpClient(clientHandlerStub);

            factory.CreateClient().Returns(client);

            var rest = _provider.GetService <IRestClient>();
            await Assert.ThrowsAsync <RestRequestFailedException>(() => rest.GetAsync <object>(UrlSample));
        }
        public void GetAsync_ValidUrl_Success()
        {
            var factory           = _provider.GetService <IHttpClientFactory>();
            var clientHandlerStub = new DelegatingHandlerStub(new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent("{}")
            });
            var client = new HttpClient(clientHandlerStub);

            factory.CreateClient().Returns(client);

            var rest     = _provider.GetService <IRestClient>();
            var response = rest.GetAsync <object>(UrlSample);

            Assert.NotNull(response);
        }