[ProducesResponseType(500)] //Returned when there was an error in the repo public ActionResult <List <CartLine> > GetCartLines(long id) { var cartLines = _repo.GetCartLinesByOrder(id); if (cartLines == null) { return(NoContent()); } return(Ok(cartLines)); }
public void ShouldRetrieveAllItemsFromShoppingCart() { Context.OrderId = 1; var shoppingCartRecords = _cartLineRepo.GetCartLinesByOrder(Context.OrderId).ToList(); Assert.Equal(2, shoppingCartRecords.Count); Assert.Equal(2, shoppingCartRecords[0].ProductId); Assert.Equal(4, shoppingCartRecords[0].Quantity); Assert.Equal(1, shoppingCartRecords[1].ProductId); Assert.Equal(3, shoppingCartRecords[1].Quantity); }