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); } }
public void increase_item_quantity_by(NonNegativeQuantity quantity) { _quantity = _quantity.Add(quantity); }
public void change_item_quantity_to(NonNegativeQuantity quantity) { _quantity = quantity; }
public BasketItem(ProductSnapshot product_snapshot, NonNegativeQuantity quantity) { _id = Guid.NewGuid(); _product_snapshot = product_snapshot; _quantity = quantity; }