AddToCart() public method

public AddToCart ( int id ) : System.Web.Mvc.ActionResult
id int
return System.Web.Mvc.ActionResult
コード例 #1
0
        public void AddToCartTest()
        {
            using (TransactionScope ts = new TransactionScope())
            {
                ICartIdProvider provider = new TestCartIdProvider();
                ShoppingCartController target = new ShoppingCartController(provider);
                int id = 669;
                ActionResult actual;
                actual = target.AddToCart(id);

                Assert.IsNotNull(actual);

                ShoppingCart cart = ShoppingCart.GetCart(provider);

                List<Cart> items = cart.GetCartItems();

                Assert.IsNotNull(items);
                Assert.AreEqual(1, items.Count);
                Assert.AreEqual(id, items[0].AlbumId);
                Assert.AreEqual(1, items[0].Count);
            }
        }
コード例 #2
0
 public void AddToCartTest()
 {
     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.AddToCart(id);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }