public PickedUpBasket AddProduct(ProductId productId) { return (PickedUpBasket) Apply(this, new ProductAddedToBasket( BasketId.ToString(), productId.ToString() )); }
void AssertContainsProduct(ProductId productId) { if ( ! ProductsInBasket.Contains(productId)) { throw new ProductNotInBasketException(string.Format( "Product with id {0} is not in the basket", productId )); } }
public PickedUpBasket RemoveProduct(ProductId productId) { AssertContainsProduct(productId); return (PickedUpBasket) Apply(this, new ProductRemovedFromBasket( BasketId.ToString(), productId.ToString() )); }