Exemplo n.º 1
0
        public void Process(ItemAddedToCart @event)
        {
            var cart = _carts.GetById(@event.Cart);

            cart.Add(@event.Product, @event.Quantity, new Price
            {
                Net   = @event.NetItemPrice,
                Gross = @event.GrossItemPrice
            });
            _carts.Save(cart);
        }
Exemplo n.º 2
0
        public CartEventProcessorsTests()
        {
            _fakeCarts           = A.Fake <ICarts>();
            _cartEventProcessors = new CartEventProcessors(_fakeCarts);

            // Initialize an empty cart as a baseline for all tests
            _testCart = new Cart
            {
                Id    = Guid.NewGuid(),
                Lines = new List <CartLine>()
            };

            // Arrange so test cart is always returned from processor
            A.CallTo(() => _fakeCarts.GetById(A <Guid> ._)).Returns(_testCart);
        }