public void Edit_Course_Options_page_redirects_to_Index_when_course_details_are_updated() { // Given const int customisationId = 1; var courseOptions = new CourseOptions { Active = true, DiagObjSelect = true, HideInLearnerPortal = true, SelfRegister = true, }; A.CallTo( () => courseService.UpdateCourseOptions( A <CourseOptions> ._, customisationId ) ).DoesNothing(); var editCourseOptionsViewModel = new EditCourseOptionsViewModel(courseOptions, customisationId); // When var result = controller.EditCourseOptions(customisationId, editCourseOptionsViewModel); // Then A.CallTo( () => courseService.UpdateCourseOptions( A <CourseOptions> ._, customisationId ) ).MustHaveHappened(); result.Should().BeRedirectToActionResult().WithControllerName("ManageCourse").WithActionName("Index"); }
public IActionResult EditCourseOptions( int customisationId, EditCourseOptionsViewModel editCourseOptionsViewModel ) { var courseOptions = new CourseOptions { Active = editCourseOptionsViewModel.Active, SelfRegister = editCourseOptionsViewModel.AllowSelfEnrolment, HideInLearnerPortal = editCourseOptionsViewModel.HideInLearningPortal, DiagObjSelect = editCourseOptionsViewModel.DiagnosticObjectiveSelection, }; courseService.UpdateCourseOptions(courseOptions, customisationId); return(RedirectToAction("Index", "ManageCourse", new { customisationId })); }