public void DeletePostAction_SaveModel_Absence() { // Arrange (Организация) var mock = new Mock <IAbsenceRepository>(); Absence absence = new Absence(); absence.Id = 1; AbsenceController controller = new AbsenceController(mock.Object); // Act (Действие) RedirectToRouteResult result = controller.DeleteConfirmed(absence) as RedirectToRouteResult; // Assert (Утверждение) mock.Verify(a => a.Delete(absence.Id)); }
public void DeletePostAction_RedirectToIndexView_Absence() { // Arrange (Организация) string expected = "Index"; var mock = new Mock <IAbsenceRepository>(); Absence absence = new Absence(); absence.Id = 1; AbsenceController controller = new AbsenceController(mock.Object); // Act (Действие) RedirectToRouteResult result = controller.DeleteConfirmed(absence) as RedirectToRouteResult; // Assert (Утверждение) Assert.IsNotNull(result); Assert.AreEqual(expected, result.RouteValues["action"]); }