Ejemplo n.º 1
0
        public void MaximumNumberOfFoodItemsExceededWithMultipleQuantity()
        {
            SellItemsRequest tooManyFoodItemsRequest = new SellItemsRequest();

            tooManyFoodItemsRequest.SetRequests(new List <SellItemRequest>());

            SellItemRequest foodItemRequest = new SellItemRequest();

            foodItemRequest.SetProductName("salad");
            foodItemRequest.SetQuantity(30);
            tooManyFoodItemsRequest.GetRequests().Add(foodItemRequest);

            foodItemRequest = new SellItemRequest();
            foodItemRequest.SetProductName("tomato");
            foodItemRequest.SetQuantity(71);
            tooManyFoodItemsRequest.GetRequests().Add(foodItemRequest);

            Action act = () => useCase.Run(tooManyFoodItemsRequest);

            act.Should().Throw <MaximumNumberOfFoodItemsExceeded>();
        }
Ejemplo n.º 2
0
        public void UnknownProduct()
        {
            SellItemsRequest request = new SellItemsRequest();

            request.SetRequests(new List <SellItemRequest>());
            SellItemRequest unknownProductRequest = new SellItemRequest();

            unknownProductRequest.SetProductName("unknown product");
            request.GetRequests().Add(unknownProductRequest);

            Action act = () => useCase.Run(request);

            act.Should().Throw <UnknownProductException>();
        }
Ejemplo n.º 3
0
        public void maximumNumberOfFoodItemsExceededWithSingleQuantity()
        {
            SellItemsRequest tooManyFoodItemsRequest = new SellItemsRequest();

            tooManyFoodItemsRequest.SetRequests(new List <SellItemRequest>());

            for (int i = 0; i <= 100; i++)
            {
                SellItemRequest foodItemRequest = new SellItemRequest();
                foodItemRequest.SetProductName("salad");
                foodItemRequest.SetQuantity(1);
                tooManyFoodItemsRequest.GetRequests().Add(foodItemRequest);
            }

            Action act = () => useCase.Run(tooManyFoodItemsRequest);

            act.Should().Throw <MaximumNumberOfFoodItemsExceeded>();
        }