public void Slash_Tasks_Slash_New_Displays_New_Task_Form() { // Arrange TasksController controller = new TasksController(); // Act ViewResult result = controller.New(); // Assert Assert.AreEqual("New Task", result.ViewBag.Title); }
public void Slash_Tasks_Slash_New_Has_Empty_View_Model() { // Arrange TasksController controller = new TasksController(); // Act EditTaskViewModel viewModel = (EditTaskViewModel)controller.New().Model; // Assert Assert.IsNull(viewModel.Task.Description); }
public void POST_To_Slash_Tasks_Slash_New_Redirects_To_Slash_Tasks() { // Arrange TasksController controller = new TasksController(); Task newTask = new Task() { Description = "Description" }; // Act RedirectToRouteResult result = controller.New(newTask) as RedirectToRouteResult; // Assert Assert.AreEqual("tasks", result.RouteValues["controller"]); Assert.AreEqual("index", result.RouteValues["action"]); }