Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        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());
        }