Exemplo n.º 1
0
        public void Redirect2()
        {
            var controller = new ExampleController();

            var result = controller.Redirect2();

            Assert.AreEqual("Example", result.RouteValues["controller"]);
            Assert.AreEqual("Index", result.RouteValues["action"]);
            Assert.AreEqual("MyID", result.RouteValues["ID"]);
        }
Exemplo n.º 2
0
        public void TestMethod2()
        {
            ExampleController exam = new ExampleController();

            ViewResult result = exam.Index();

            Assert.AreEqual("Hello", result.ViewBag.Message);

            RedirectResult result2 = exam.Redirect();

            Assert.IsTrue(result2.Permanent);
            Assert.AreEqual("/Example/Index", result2.Url);

            RedirectToRouteResult result3 = exam.Redirect2();

            Assert.IsFalse(result3.Permanent);
            Assert.AreEqual("Example", result3.RouteValues["controller"]);
            Assert.AreEqual("Index", result3.RouteValues["action"]);
            Assert.AreEqual("MyID", result3.RouteValues["ID"]);
        }