public void AddAdminFieldToCourse_adds_prompt_to_course_at_next_prompt_number() { // Given A.CallTo ( () => courseAdminFieldsDataService.UpdateAdminFieldForCourse(100, A <int> ._, A <int> ._, null) ).DoesNothing(); A.CallTo(() => courseAdminFieldsDataService.GetCourseAdminFields(100)) .Returns(PromptsTestHelper.GetDefaultCourseAdminFieldsResult()); // When var result = courseAdminFieldsService.AddAdminFieldToCourse(100, 3, null); // Then A.CallTo ( () => courseAdminFieldsDataService.UpdateAdminFieldForCourse(100, 3, 3, null) ).MustHaveHappened(); result.Should().BeTrue(); }
public void AddAdminField_save_redirects_to_index() { // Given var model = new AddAdminFieldViewModel(1, "Test"); const string action = "save"; var initialTempData = new AddAdminFieldTempData { AdminFieldId = model.AdminFieldId, OptionsString = model.OptionsString }; A.CallTo( () => multiPageFormService.GetMultiPageFormData <AddAdminFieldTempData>( MultiPageFormDataFeature.AddAdminField, controller.TempData ) ).Returns(initialTempData); A.CallTo( () => courseAdminFieldsService.AddAdminFieldToCourse( 100, 1, "Test" ) ).Returns(true); // When var result = controller.AddAdminField(100, model, action); // Then A.CallTo( () => multiPageFormService.ClearMultiPageFormData( MultiPageFormDataFeature.AddAdminField, controller.TempData ) ).MustHaveHappenedOnceExactly(); result.Should().BeRedirectToActionResult().WithActionName("Index"); }