public void CreateShouldDisplayTheCorrectView() { //ARRANGE var controller = new SchoolsController(null); //ACT var result = controller.Create() as ViewResult; //ASSERT Assert.NotNull(result); Assert.NotNull(result.Model); Assert.That(result.ViewName, Is.EqualTo("Create")); }
public void CreateShouldSaveAndDisplayCorrectView() { //ARRANGE var model = new SchoolViewModel { Name = "School One" }; var logic = new Mock <ISchoolLogic>(); logic .Setup(x => x.Create(It.IsAny <School>())) .Verifiable("Should create class"); var controller = new SchoolsController(logic.Object); //ACT var result = controller.Create(model) as RedirectToRouteResult; //ASSERT logic.Verify(); Assert.NotNull(result); Assert.AreEqual("Index", result.RouteValues["Action"]); }