コード例 #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()
            ));
        }