public async Task <List <Product> > GetProductsAsync() { Uri endpointUri = new Uri(_readConfig.ReadBaseUrl() + _readConfig.ReadProduct()); endpointUri = endpointUri.AddQuery("Token", _readConfig.UserId()); var requestMessage = new HttpRequestMessage(HttpMethod.Get, endpointUri); _logger.Information("Sending request to {uri}", endpointUri); var response = await _client.SendAsync(requestMessage); if (response.StatusCode != HttpStatusCode.OK) { _logger.Error("Product repository exception"); throw new HttpResponseException(response); } var contents = await response.Content.ReadAsStringAsync(); return(_deserializer.Deserialize <List <Product> >(contents)); }
ReadProduct_ReadProductNotPresent_ThrowConfigurationErrorsException () { Assert.Throws <ConfigurationErrorsException>(() => _config.ReadProduct()); }