예제 #1
0
        public void MyAccountViewModel_DelegateUser_no_AdminUser_populates_expected_values()
        {
            // Given
            var delegateUser  = UserTestHelper.GetDefaultDelegateUser();
            var customPrompts = PromptsTestHelper.GetDefaultCentreRegistrationPromptsWithAnswers(
                new List <CentreRegistrationPromptWithAnswer>
            {
                PromptsTestHelper.GetDefaultCentreRegistrationPromptWithAnswer(1),
            }
                );

            // When
            var returnedModel = new MyAccountViewModel(null, delegateUser, customPrompts, DlsSubApplication.Default);

            // Then
            using (new AssertionScope())
            {
                returnedModel.FirstName.Should().BeEquivalentTo(delegateUser.FirstName);
                returnedModel.Centre.Should().BeEquivalentTo(delegateUser.CentreName);
                returnedModel.Surname.Should().BeEquivalentTo(delegateUser.LastName);
                returnedModel.ProfilePicture.Should().BeEquivalentTo(delegateUser.ProfileImage);
                returnedModel.DelegateNumber.Should().BeEquivalentTo(delegateUser.CandidateNumber);
                returnedModel.User.Should().BeEquivalentTo(delegateUser.EmailAddress);
                returnedModel.JobGroup.Should().BeEquivalentTo(delegateUser.JobGroupName);
                returnedModel.DelegateRegistrationPrompts.Should().NotBeNullOrEmpty();
            }
        }
예제 #2
0
        public void MyAccountViewModel_CustomFields_ShouldBePopulated()
        {
            // Given
            var delegateUser  = UserTestHelper.GetDefaultDelegateUser();
            var customPrompts = PromptsTestHelper.GetDefaultCentreRegistrationPromptsWithAnswers(
                new List <CentreRegistrationPromptWithAnswer>
            {
                PromptsTestHelper.GetDefaultCentreRegistrationPromptWithAnswer(1),
                PromptsTestHelper.GetDefaultCentreRegistrationPromptWithAnswer(2),
            }
                );

            // When
            var returnedModel = new MyAccountViewModel(null, delegateUser, customPrompts, DlsSubApplication.Default);

            // Then
            using (new AssertionScope())
            {
                returnedModel.DelegateRegistrationPrompts.Should().NotBeNullOrEmpty();
                returnedModel.DelegateRegistrationPrompts[0].PromptNumber.Should().Be(1);
                returnedModel.DelegateRegistrationPrompts[0].Prompt.Should()
                .BeEquivalentTo(customPrompts.CustomPrompts[0].PromptText);
                returnedModel.DelegateRegistrationPrompts[0].Answer.Should().BeEquivalentTo(delegateUser.Answer1);
                returnedModel.DelegateRegistrationPrompts[0].Mandatory.Should().BeFalse();

                returnedModel.DelegateRegistrationPrompts[1].PromptNumber.Should().Be(2);
                returnedModel.DelegateRegistrationPrompts[1].Prompt.Should()
                .BeEquivalentTo(customPrompts.CustomPrompts[1].PromptText);
                returnedModel.DelegateRegistrationPrompts[1].Answer.Should().BeEquivalentTo(delegateUser.Answer1);
                returnedModel.DelegateRegistrationPrompts[1].Mandatory.Should().BeFalse();
            }
        }
예제 #3
0
        public void MyAccountViewModel_where_user_has_not_been_asked_for_prn_says_not_yet_provided()
        {
            // Given
            var delegateUser = UserTestHelper.GetDefaultDelegateUser(
                hasBeenPromptedForPrn: false,
                professionalRegistrationNumber: null
                );
            var customPrompts = PromptsTestHelper.GetDefaultCentreRegistrationPromptsWithAnswers(
                new List <CentreRegistrationPromptWithAnswer> {
            }
                );

            // When
            var returnedModel = new MyAccountViewModel(null, delegateUser, customPrompts, DlsSubApplication.Default);

            // Then
            using (new AssertionScope())
            {
                returnedModel.ProfessionalRegistrationNumber.Should().Be("Not yet provided");
            }
        }
        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);
        }
예제 #5
0
        public void MyAccountViewModel_with_prn_displays_prn()
        {
            // Given
            var delegateUser = UserTestHelper.GetDefaultDelegateUser(
                hasBeenPromptedForPrn: true,
                professionalRegistrationNumber: "12345678"
                );
            var customPrompts = PromptsTestHelper.GetDefaultCentreRegistrationPromptsWithAnswers(
                new List <CentreRegistrationPromptWithAnswer>
            {
                PromptsTestHelper.GetDefaultCentreRegistrationPromptWithAnswer(1),
                PromptsTestHelper.GetDefaultCentreRegistrationPromptWithAnswer(2),
            }
                );

            // When
            var returnedModel = new MyAccountViewModel(null, delegateUser, customPrompts, DlsSubApplication.Default);

            // Then
            using (new AssertionScope())
            {
                returnedModel.ProfessionalRegistrationNumber.Should().Be(delegateUser.ProfessionalRegistrationNumber);
            }
        }