コード例 #1
0
 public void TestDetailsViewData()
 {
     ProductController controller = new ProductController(); // TODO: Initialize to an appropriate value
     ViewResult result = controller.Details(2) as ViewResult;
     Product product = result.ViewData.Model as Product;
     Assert.AreEqual("Test", product.Name);
 }
コード例 #2
0
        public void DetailsViewTest()
        {
            ProductController controller = new ProductController(); // TODO: Initialize to an appropriate value
            ViewResult result = controller.Details(2) as ViewResult;

            Assert.AreEqual("Details", result.ViewName);
        }
コード例 #3
0
 public void TestDetailsViewRedirect()
 {
     ProductController controller = new ProductController(); // TODO: Initialize to an appropriate value
     RedirectToRouteResult result = controller.Details(-1) as RedirectToRouteResult;
     Assert.AreEqual("Index", result.RouteValues["action"]);
 }