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

            return (PickedUpBasket) Apply(this, new ProductRemovedFromBasket(
                BasketId.ToString(),
                productId.ToString()
            ));
        }