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!"); }
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); }
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); }
public void Index() { // 정렬 HomeController controller = new HomeController(); // 동작 ViewResult result = controller.Index() as ViewResult; // 어설션 Assert.AreEqual("ASP.NET MVC 응용 프로그램을 바로 시작하려면 이 템플릿을 수정하십시오.", result.ViewBag.Message); }
public void Index() { // 排列 HomeController controller = new HomeController(); // 操作 ViewResult result = controller.Index() as ViewResult; // 断言 Assert.AreEqual("欢迎使用 ASP.NET MVC!", result.ViewBag.Message); }
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"]); }
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"]); }
public void Index() { // 排列 HomeController controller = new HomeController(); // 操作 ViewResult result = controller.Index() as ViewResult; // 断言 ViewDataDictionary viewData = result.ViewData; Assert.AreEqual("欢迎使用 ASP.NET MVC!", viewData["Message"]); }
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"]); }
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"]); }