Exemple #1
0
        public void MyAccountViewModel_DelegateUser_no_AdminUser_populates_expected_values()
        {
            // Given
            var delegateUser  = UserTestHelper.GetDefaultDelegateUser();
            var customPrompts = CustomPromptsTestHelper.GetDefaultCentreCustomPromptsWithAnswers(
                new List <CustomPromptWithAnswer>
            {
                CustomPromptsTestHelper.GetDefaultCustomPromptWithAnswer(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.CustomFields.Should().NotBeNullOrEmpty();
            }
        }
Exemple #2
0
        public void MyAccountViewModel_CustomFields_ShouldBePopulated()
        {
            // Given
            var delegateUser  = UserTestHelper.GetDefaultDelegateUser();
            var customPrompts = CustomPromptsTestHelper.GetDefaultCentreCustomPromptsWithAnswers(
                new List <CustomPromptWithAnswer>
            {
                CustomPromptsTestHelper.GetDefaultCustomPromptWithAnswer(1),
                CustomPromptsTestHelper.GetDefaultCustomPromptWithAnswer(2),
            }
                );

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

            // Then
            using (new AssertionScope())
            {
                returnedModel.CustomFields.Should().NotBeNullOrEmpty();
                returnedModel.CustomFields[0].CustomFieldId.Should().Be(1);
                returnedModel.CustomFields[0].CustomPrompt.Should()
                .BeEquivalentTo(customPrompts.CustomPrompts[0].CustomPromptText);
                returnedModel.CustomFields[0].Answer.Should().BeEquivalentTo(delegateUser.Answer1);
                returnedModel.CustomFields[0].Mandatory.Should().BeFalse();

                returnedModel.CustomFields[1].CustomFieldId.Should().Be(2);
                returnedModel.CustomFields[1].CustomPrompt.Should()
                .BeEquivalentTo(customPrompts.CustomPrompts[1].CustomPromptText);
                returnedModel.CustomFields[1].Answer.Should().BeEquivalentTo(delegateUser.Answer1);
                returnedModel.CustomFields[1].Mandatory.Should().BeFalse();
            }
        }
Exemple #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 = CustomPromptsTestHelper.GetDefaultCentreCustomPromptsWithAnswers(
                new List <CustomPromptWithAnswer> {
            }
                );

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

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

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

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