public void AddAdminFieldAnswersBulk_updates_temp_data_and_redirects_to_add() { // Given var inputViewModel = new AddBulkAdminFieldAnswersViewModel("Test\r\nAnswer", 1); var initialAddViewModel = new AddAdminFieldViewModel(1, "Test"); var expectedData = new AddAdminFieldTempData { AdminFieldId = 1, OptionsString = "Test\r\nAnswer" }; var initialTempData = new AddAdminFieldTempData { AdminFieldId = initialAddViewModel.AdminFieldId, OptionsString = initialAddViewModel.OptionsString }; A.CallTo( () => multiPageFormService.GetMultiPageFormData <AddAdminFieldTempData>( MultiPageFormDataFeature.AddAdminField, controller.TempData ) ).Returns(initialTempData); // When var result = controller.AddAdminFieldAnswersBulk(1, inputViewModel); // Then using (new AssertionScope()) { AssertAddAdminFieldMultiPageFormDataIsUpdatedCorrectly(expectedData); result.Should().BeRedirectToActionResult().WithActionName("AddAdminField"); } }
public void AddAdminFieldAnswersBulk_updates_temp_data_and_redirects_to_add() { // Given var inputViewModel = new AddBulkAdminFieldAnswersViewModel("Test\r\nAnswer", 1); var initialAddViewModel = new AddAdminFieldViewModel(1, "Test"); var expectedViewModel = new AddAdminFieldViewModel(1, "Test\r\nAnswer"); var initialTempData = new AddAdminFieldData(initialAddViewModel); controller.TempData.Set(initialTempData); // When var result = controller.AddAdminFieldAnswersBulk(1, inputViewModel); // Then using (new AssertionScope()) { AssertAddTempDataIsExpected(expectedViewModel); result.Should().BeRedirectToActionResult().WithActionName("AddAdminField"); } }