public void apiresourceproxy_should_throw_exception_if_get_shopper_history_error_response(HttpStatusCode errorStatusCode)
        {
            // Assert
            _sut = GetClient <IApiResourceProxy>("http://apihost.com/api/resource/", errorStatusCode);

            // Act
            Func <Task> action = async() => await _sut.GetShopperHistory();

            // Assert
            action.Should().Throw <HttpRequestException>();

            if (errorStatusCode != HttpStatusCode.Unauthorized && errorStatusCode != HttpStatusCode.BadRequest)
            {
                action = async() => await _sut.GetShopperHistory();

                action.Should().Throw <BrokenCircuitException>();
            }
        }
 public ProductSorterByRecommendedTests()
 {
     // Arrange
     _apiResourceProxy = Substitute.For <IApiResourceProxy>();
     _sut = new ProductSorterByRecommended(_apiResourceProxy);
 }
 public ApiResourceProxyTests()
 {
     // Arrange
     _sut = GetClient <IApiResourceProxy>("http://apihost.com/api/resource/");
 }
 public ProductSorterFactoryTests()
 {
     // Arrange
     _apiResourceProxy = Substitute.For <IApiResourceProxy>();
     _sut = new ProductSorterFactory(_apiResourceProxy);
 }
 public ProductSorterByRecommended(IApiResourceProxy apiResourceProxy)
 {
     _apiResourceProxy = apiResourceProxy;
 }
 public ProductSorterFactory(IApiResourceProxy apiResourceProxy)
 {
     _apiResourceProxy = apiResourceProxy;
 }
Example #7
0
 public ProductsService(IApiResourceProxy apiResourceProxy, IProductSorterFactory productSorterFactory)
 {
     _apiResourceProxy     = apiResourceProxy;
     _productSorterFactory = productSorterFactory;
 }
Example #8
0
 public ProductServiceTests()
 {
     _apiResourceProxy     = Substitute.For <IApiResourceProxy>();
     _productSorterFactory = new ProductSorterFactory(_apiResourceProxy);
     _sut = new ProductsService(_apiResourceProxy, _productSorterFactory);
 }