public void CanInsertItemIntoEmptyRevisitedCart() { var cart = RevisitedCart.Create(1); cart.InsertNewCartItem(1, 1, 9.99m); Assert.AreEqual(1, cart.CartItems.Count()); }
public RevisitedCart RetrieveCart(int cartId) { var cart = _context.Carts.AsNoTracking().Where(c => c.CartId == cartId). Select(c => new { c.CartId, c.CartItems }).SingleOrDefault(); if (cart != null) { return(RevisitedCart.CreateWithItems(cart.CartId, cart.CartItems)); } return(RevisitedCart.Create(cartId)); }
public void CanCreateRevisitedCartWithNoItems() { var cart = RevisitedCart.Create(1); Assert.AreEqual(1, cart.CartId); }