RemoveFromCart() private method

private RemoveFromCart ( int id ) : System.Web.Mvc.ActionResult
id int
return System.Web.Mvc.ActionResult
Ejemplo n.º 1
0
        public void RemoveFromCartTest()
        {
            using (TransactionScope ts = new TransactionScope())
            {
                Album album1 = this.GetAlbum(669);
                Album album2 = this.GetAlbum(668);

                ICartIdProvider provider = new TestCartIdProvider();
                ShoppingCart cart = ShoppingCart.GetCart(provider);

                cart.AddToCart(album1);
                cart.AddToCart(album2);
                cart.AddToCart(album2);

                ShoppingCartController target = new ShoppingCartController(provider);
                int id = cart.GetCartItems().First().RecordId;
                ActionResult actual;
                actual = target.RemoveFromCart(id);

                Assert.IsNotNull(actual);
                Assert.IsInstanceOfType(actual, typeof(JsonResult));

                JsonResult jsonResult = (JsonResult)actual;

                Assert.IsInstanceOfType(jsonResult.Data, typeof(ShoppingCartRemoveViewModel));

                ShoppingCartRemoveViewModel model = (ShoppingCartRemoveViewModel)jsonResult.Data;

                Assert.AreEqual(2, model.CartCount);
                Assert.AreEqual(id, model.DeleteId);
            }
        }
Ejemplo n.º 2
0
 public void RemoveFromCartTest()
 {
     ShoppingCartController target = new ShoppingCartController(); // TODO: Initialize to an appropriate value
     int id = 0; // TODO: Initialize to an appropriate value
     ActionResult expected = null; // TODO: Initialize to an appropriate value
     ActionResult actual;
     actual = target.RemoveFromCart(id);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }