Index() public method

public Index ( ) : System.Web.Mvc.ActionResult
return System.Web.Mvc.ActionResult
コード例 #1
0
        public void Index()
        {
            var controller = new HomeController();

            var result = controller.Index() as ViewResult;

            Assert.AreEqual(null, result.ViewBag.Message);

            //Assert.Fail("Make it #FAIL on purpose!");
        }
コード例 #2
0
        public void Index()
        {
            // Arrange
            HomeController controller = new HomeController();

            // Act
            ViewResult result = controller.Index() as ViewResult;

            // Assert
            Assert.AreEqual("Welcome to ASP.NET MVC!", result.ViewBag.Message);
        }
コード例 #3
0
        public void Index()
        {
            // Arrange
            HomeController controller = new HomeController();

            // Act
            ViewResult result = controller.Index() as ViewResult;

            // Assert
            Assert.AreEqual("Modify this template to jump-start your ASP.NET MVC application.", result.ViewBag.Message);
        }
コード例 #4
0
        public void Index()
        {
            // 정렬
            HomeController controller = new HomeController();

            // 동작
            ViewResult result = controller.Index() as ViewResult;

            // 어설션
            Assert.AreEqual("ASP.NET MVC 응용 프로그램을 바로 시작하려면 이 템플릿을 수정하십시오.", result.ViewBag.Message);
        }
コード例 #5
0
        public void Index()
        {
            // 排列
            HomeController controller = new HomeController();

            // 操作
            ViewResult result = controller.Index() as ViewResult;

            // 断言
            Assert.AreEqual("欢迎使用 ASP.NET MVC!", result.ViewBag.Message);
        }
コード例 #6
0
        public void Index()
        {
            // Arrange
            HomeController controller = new HomeController();

            // Act
            ViewResult result = controller.Index() as ViewResult;

            // Assert
            ViewDataDictionary viewData = result.ViewData;
            Assert.AreEqual("Welcome to ASP.NET MVC!", viewData["Message"]);
        }
コード例 #7
0
        public void Index()
        {
            // Disponer
            HomeController controller = new HomeController();

            // Actuar
            ViewResult result = controller.Index() as ViewResult;

            // Declarar
            ViewDataDictionary viewData = result.ViewData;
            Assert.AreEqual("Buscar destinos:", viewData["Message"]);
        }
コード例 #8
0
ファイル: HomeControllerTest.cs プロジェクト: junxy/WebData
        public void Index()
        {
            // 排列
            HomeController controller = new HomeController();

            // 操作
            ViewResult result = controller.Index() as ViewResult;

            // 断言
            ViewDataDictionary viewData = result.ViewData;
            Assert.AreEqual("欢迎使用 ASP.NET MVC!", viewData["Message"]);
        }
コード例 #9
0
        public void Index()
        {
            // Setup
            HomeController controller = new HomeController();

            // Execute
            ViewResult result = controller.Index() as ViewResult;

            // Verify
            ViewDataDictionary viewData = result.ViewData;
            Assert.AreEqual("Home Page", viewData["Title"]);
            Assert.AreEqual("Welcome to ASP.NET MVC!", viewData["Message"]);
        }
コード例 #10
0
        public void Index()
        {
            // Arrange
            var controller = new HomeController();

            // Act
            var result = controller.Index();

            // Did we get a view result?
            Assert.IsInstanceOfType(result, typeof(ViewResult));

            // Did we get a view named Index?
            var indexResult = (ViewResult)result;
            Assert.AreEqual("Index", indexResult.ViewName);

            // Did we get message in view data?
            Assert.AreEqual("Hello World!", indexResult.ViewData["message"]);
        }