public IActionResult Index(DlsSubApplication dlsSubApplication) { var userAdminId = User.GetAdminId(); var userDelegateId = User.GetCandidateId(); var(adminUser, delegateUser) = userService.GetUsersById(userAdminId, userDelegateId); var customPrompts = centreRegistrationPromptsService.GetCentreRegistrationPromptsWithAnswersByCentreIdAndDelegateUser( User.GetCentreId(), delegateUser ); var model = new MyAccountViewModel(adminUser, delegateUser, customPrompts, dlsSubApplication); return(View(model)); }
public void GetCentreRegistrationPromptsWithAnswersByCentreIdAndDelegateUser_Returns_Populated_CentreRegistrationPrompts() { // Given var answer1 = "Answer 1"; var delegateUser = UserTestHelper.GetDefaultDelegateUser(answer1: answer1); var expectedPrompt1 = PromptsTestHelper.GetDefaultCentreRegistrationPromptWithAnswer( 1, options: null, mandatory: true, answer: answer1, promptId: 3 ); var expectedPrompt2 = PromptsTestHelper.GetDefaultCentreRegistrationPromptWithAnswer(2, "Department / team", null, true); var centreRegistrationPrompts = new List <CentreRegistrationPromptWithAnswer> { expectedPrompt1, expectedPrompt2 }; var expectedCustomerPrompts = PromptsTestHelper.GetDefaultCentreRegistrationPromptsWithAnswers(centreRegistrationPrompts); A.CallTo(() => centreRegistrationPromptsDataService.GetCentreRegistrationPromptsByCentreId(29)) .Returns ( PromptsTestHelper.GetDefaultCentreRegistrationPromptsResult( centreRegistrationPrompt1Prompt: "Custom Prompt", centreRegistrationPrompt1Options: null ) ); // When var result = centreRegistrationPromptsService.GetCentreRegistrationPromptsWithAnswersByCentreIdAndDelegateUser(29, delegateUser); // Then result.Should().BeEquivalentTo(expectedCustomerPrompts); }