GetUnapprovedDelegatesWithRegistrationPromptAnswersForCentre_returns_unapproved_delegates_with_registration_prompt_answers_for_centre()
        {
            // Given
            var expectedDelegateUser = UserTestHelper.GetDefaultDelegateUser();
            var expectedUserList     = new List <DelegateUser> {
                expectedDelegateUser
            };
            var expectedRegistrationPrompts = new List <CentreRegistrationPromptWithAnswer>
            {
                PromptsTestHelper.GetDefaultCentreRegistrationPromptWithAnswer(
                    1,
                    options: null,
                    mandatory: true,
                    answer: "answer"
                    )
            };

            A.CallTo(() => userDataService.GetUnapprovedDelegateUsersByCentreId(2))
            .Returns(expectedUserList);
            A.CallTo(
                () => centreRegistrationPromptsService.GetCentreRegistrationPromptsWithAnswersByCentreIdForDelegateUsers(
                    2,
                    expectedUserList
                    )
                )
            .Returns(
                new List <(DelegateUser delegateUser, List <CentreRegistrationPromptWithAnswer> prompts)>
            {
                (expectedDelegateUser, expectedRegistrationPrompts)
            }
        GetUnapprovedDelegatesWithRegistrationPromptAnswersForCentre(int centreId)
        {
            var users            = userDataService.GetUnapprovedDelegateUsersByCentreId(centreId);
            var usersWithPrompts =
                centreRegistrationPromptsService.GetCentreRegistrationPromptsWithAnswersByCentreIdForDelegateUsers(centreId, users);

            return(usersWithPrompts);
        }
        public void GetCentreRegistrationPromptsWithAnswersByCentreIdForDelegateUsers_Returns_Populated_Tuple()
        {
            // Given
            const string answer1         = "Answer 1";
            const string answer2         = "Answer 2";
            var          delegateUser1   = UserTestHelper.GetDefaultDelegateUser(answer1: answer1);
            var          delegateUser2   = UserTestHelper.GetDefaultDelegateUser(answer1: answer2);
            var          expectedPrompt1 = PromptsTestHelper.GetDefaultCentreRegistrationPromptWithAnswer(
                1,
                options: null,
                mandatory: true,
                answer: answer1,
                promptId: 3
                );
            var expectedPrompt2 =
                PromptsTestHelper.GetDefaultCentreRegistrationPromptWithAnswer(2, "Department / team", null, true);
            var expectedPrompt3 = PromptsTestHelper.GetDefaultCentreRegistrationPromptWithAnswer(
                1,
                options: null,
                mandatory: true,
                answer: answer2,
                promptId: 3
                );

            A.CallTo(() => centreRegistrationPromptsDataService.GetCentreRegistrationPromptsByCentreId(29))
            .Returns(
                PromptsTestHelper.GetDefaultCentreRegistrationPromptsResult(
                    centreRegistrationPrompt1Prompt: "Custom Prompt",
                    centreRegistrationPrompt1Options: null
                    )
                );

            // When
            var result = centreRegistrationPromptsService.GetCentreRegistrationPromptsWithAnswersByCentreIdForDelegateUsers(
                29,
                new[] { delegateUser1, delegateUser2 }
                );

            // Then
            using (new AssertionScope())
            {
                result.Count.Should().Be(2);

                var first = result.First();
                first.Item1.Should().BeEquivalentTo(delegateUser1);
                first.Item2.Count.Should().Be(2);
                first.Item2[0].Should().BeEquivalentTo(expectedPrompt1);
                first.Item2[1].Should().BeEquivalentTo(expectedPrompt2);

                var second = result.Last();
                second.Item1.Should().BeEquivalentTo(delegateUser2);
                second.Item2.Count.Should().Be(2);
                second.Item2[0].Should().BeEquivalentTo(expectedPrompt3);
                second.Item2[1].Should().BeEquivalentTo(expectedPrompt2);
            }
        }