public void HandleTestWithException() { ShoppingCartRepository.ClearCart(); var productCommandProxy = new ProductCommandProxy(); var command = new AddQuantityCommand() { ProductId = 0, Quantity = 5 }; productCommandProxy.Store(command); command = new AddQuantityCommand() { ProductId = 0, Quantity = 16 }; productCommandProxy.Store(command); while (!productCommandProxy.Process()) { } }
// POST api/products public void Post(ShoppingCartElement cartElement) { if (cartElement != null) { var command = new AddQuantityCommand(); command.ProductId = cartElement.ProductId; command.Quantity = cartElement.Quantity; commandProxy.Store(command); commandProxy.Process(); } }
public void HandleTest() { ShoppingCartRepository.ClearCart(); var productCommandProxy = new ProductCommandProxy(); var command = new AddQuantityCommand() { ProductId = 1, Quantity = 5 }; productCommandProxy.Store(command); command = new AddQuantityCommand() { ProductId = 2, Quantity = 16 }; productCommandProxy.Store(command); command = new AddQuantityCommand() { ProductId = 3, Quantity = 3 }; productCommandProxy.Store(command); while(!productCommandProxy.Process()) { } List<string> shoppingCartQueryResult = (List<string>)new ShoppingCartQuery().GetNamedShoppingCartElements(); Assert.AreEqual(shoppingCartQueryResult.Count, 3); }