public void Can_Edit_Semester() { // Arrange Mock<ISemestersRepository> mock = new Mock<ISemestersRepository>(); // Arrange SemestersController target = new SemestersController(mock.Object); // Arrange Semesters semester = new Semesters { SemesterID = 1, Type = "letni", Year = "2007/2008" }; // Act ActionResult result = target.Edit(semester); // Assert mock.Verify(m => m.EditSemester(semester)); // Assert Assert.AreEqual("Zauktalizowano semestr!", target.TempData["message"]); Assert.IsInstanceOfType(typeof(RedirectToRouteResult), result); }
public void Can_Edit_Semester() { // Arrange Mock <ISemestersRepository> mock = new Mock <ISemestersRepository>(); // Arrange SemestersController target = new SemestersController(mock.Object); // Arrange Semesters semester = new Semesters { SemesterID = 1, Type = "letni", Year = "2007/2008" }; // Act ActionResult result = target.Edit(semester); // Assert mock.Verify(m => m.EditSemester(semester)); // Assert Assert.AreEqual("Zauktalizowano semestr!", target.TempData["message"]); Assert.IsInstanceOfType(typeof(RedirectToRouteResult), result); }