Ejemplo n.º 1
0
        public void change_quantity_of_product(NonNegativeQuantity quantity, ProductSnapshot product_snapshot, IBasketPricingService basket_pricing_service)
        {
            // TODO: Check for null values and invalid data

            if (basket_contains_an_item_for(product_snapshot))
            {
                if (quantity.is_zero())
                {
                    remove_product_with_id_of(product_snapshot, basket_pricing_service);
                }
                else
                {
                    get_item_for(product_snapshot).change_item_quantity_to(quantity);
                }

                recalculate_basket_totals(basket_pricing_service);
            }
        }
Ejemplo n.º 2
0
 public void increase_item_quantity_by(NonNegativeQuantity quantity)
 {
     _quantity = _quantity.Add(quantity);
 }
Ejemplo n.º 3
0
 public void change_item_quantity_to(NonNegativeQuantity quantity)
 {
     _quantity = quantity;
 }
Ejemplo n.º 4
0
 public BasketItem(ProductSnapshot product_snapshot, NonNegativeQuantity quantity)
 {
     _id = Guid.NewGuid();
     _product_snapshot = product_snapshot;
     _quantity         = quantity;
 }