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)); }
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); }