public IActionResult Index(DlsSubApplication dlsSubApplication) { var userAdminId = User.GetAdminId(); var userDelegateId = User.GetCandidateId(); var(adminUser, delegateUser) = userService.GetUsersById(userAdminId, userDelegateId); var customPrompts = centreCustomPromptsService.GetCentreCustomPromptsWithAnswersByCentreIdAndDelegateUser( User.GetCentreId(), delegateUser ); var model = new MyAccountViewModel(adminUser, delegateUser, customPrompts, dlsSubApplication); return(View(model)); }
public void GetCentreCustomPromptsWithAnswersByCentreIdAndDelegateUser_Returns_Populated_CentreCustomPrompts() { // Given var answer1 = "Answer 1"; var delegateUser = UserTestHelper.GetDefaultDelegateUser(answer1: answer1); var expectedPrompt1 = CustomPromptsTestHelper.GetDefaultCustomPromptWithAnswer( 1, options: null, mandatory: true, answer: answer1 ); var expectedPrompt2 = CustomPromptsTestHelper.GetDefaultCustomPromptWithAnswer(2, "Department / team", null, true); var customPrompts = new List <CustomPromptWithAnswer> { expectedPrompt1, expectedPrompt2 }; var expectedCustomerPrompts = CustomPromptsTestHelper.GetDefaultCentreCustomPromptsWithAnswers(customPrompts); A.CallTo(() => centreCustomPromptsDataService.GetCentreCustomPromptsByCentreId(29)) .Returns ( CustomPromptsTestHelper.GetDefaultCentreCustomPromptsResult( customField1Prompt: "Custom Prompt", customField1Options: null ) ); // When var result = centreCustomPromptsService.GetCentreCustomPromptsWithAnswersByCentreIdAndDelegateUser(29, delegateUser); // Then result.Should().BeEquivalentTo(expectedCustomerPrompts); }