public void Delete_DeleteEntrollment_ReturnsOkResult_Positive() { int enrollmentId = 1; _wordProgressService.Setup(x => x.RemoveProgressesForEnrollment(enrollmentId)); _wordSuiteService.Setup(x => x.RemoveWordSuitesForEnrollment(enrollmentId)); _enrollmentService.Setup(x => x.DeleteById(enrollmentId)); var actual = _controller.Delete(enrollmentId); Assert.IsInstanceOf(typeof(OkResult), actual); }
public void Delete_DeleteEntrollment_ReturnsBadRequestResult_Negative() { int enrollmentId = 1; GenerateData("1", new[] { "NoRoles" }); Mock <IEnrollmentMapper> enrollmentMapper = new Mock <IEnrollmentMapper>(); Mock <ICourseService> courseService = new Mock <ICourseService>(); Mock <IEnrollmentService> enrollmentService = new Mock <IEnrollmentService>(); Mock <IWordSuiteService> wordSuiteService = new Mock <IWordSuiteService>(); Mock <IWordProgressService> wordProgressService = new Mock <IWordProgressService>(); Mock <IGroupService> groupService = new Mock <IGroupService>(); Mock <IUserForListingMapper> userMapper = new Mock <IUserForListingMapper>(); EnrollmentController controller = new EnrollmentController(enrollmentService.Object, enrollmentMapper.Object, wordSuiteService.Object, wordProgressService.Object, userMapper.Object, courseService.Object, groupService.Object); wordProgressService.Setup(x => x.RemoveProgressesForEnrollment(enrollmentId)).Returns(true); wordSuiteService.Setup(x => x.RemoveWordSuitesForEnrollment(enrollmentId)).Returns(false); enrollmentService.Setup(x => x.DeleteById(enrollmentId)).Returns(true); var actual = controller.Delete(enrollmentId); Assert.IsInstanceOf(typeof(BadRequestErrorMessageResult), actual); }