public void ShoppingCart_AddItemWillDispatchItemAdded() { var cart = new Data.ShoppingCart(Guid.NewGuid()); cart.ClearEvents(); cart.AddItem(Guid.NewGuid(), "My cart item"); Assert.Single(cart.GetEvents()); Assert.IsType <ItemAddedToCart>(cart.GetEvents().First()); }
public void ShoppingCart_RemoveItemDispatchItemRemoved() { var cart = new Data.ShoppingCart(Guid.NewGuid()); var itemId = Guid.NewGuid(); cart.AddItem(itemId, "foo"); cart.ClearEvents(); cart.RemoveItem(itemId); Assert.Single(cart.GetEvents()); Assert.IsType <ItemRemovedFromCart>(cart.GetEvents().First()); }