Esempio n. 1
0
        public void Can_increment_session_cart_qty()
        {
            var client  = new JsonServiceClient(Config.AbsoluteBaseUri);
            var request = new SessionCartIncr {
                CartId = Guid.NewGuid()
            };

            Assert.That(client.Get(request).Qty, Is.EqualTo(1));
            Assert.That(client.Get(request).Qty, Is.EqualTo(2));
        }
Esempio n. 2
0
        public Cart Get(SessionCartIncr request)
        {
            var sessionKey = UrnId.Create <Cart>(request.CartId);
            var cart       = base.SessionBag.Get <Cart>(sessionKey) ?? new Cart();

            cart.Qty++;

            base.SessionBag[sessionKey] = cart;

            return(cart);
        }