public ActionResult RemoveFromCart(Cart cart,int productID,string returnUrl) { var product = _productRepository.Products .FirstOrDefault(x => x.ProductID == productID); if (product != null) { cart.Remove(product); } return RedirectToAction("Index", new {returnUrl}); }
public void Remove_quita_producto_existente() { //Arrange var cart = new Cart(); var ptest = new Product() {ProductID = 13}; //Act cart.Add(ptest,1); cart.Remove(ptest); //Assert Assert.AreEqual(cart.Lines.Count(),0); }