public void GetDelegateRegistrationPromptsForCentre_returns_populated_list()
        {
            // Given
            var registrationPrompt1       = PromptsTestHelper.GetDefaultCentreRegistrationPrompt(1, options: "Clinical\r\nNon-Clinical");
            var registrationPrompt2       = PromptsTestHelper.GetDefaultCentreRegistrationPrompt(2);
            var centreRegistrationPrompts = PromptsTestHelper.GetDefaultCentreRegistrationPrompts(
                new List <CentreRegistrationPrompt> {
                registrationPrompt1, registrationPrompt2
            },
                1
                );

            A.CallTo(() => centreRegistrationPromptsService.GetCentreRegistrationPromptsByCentreId(1))
            .Returns(centreRegistrationPrompts);

            // When
            var result =
                promptsService.GetDelegateRegistrationPromptsForCentre(1, Answer1, Answer2, null, null, null, null);

            // Then
            using (new AssertionScope())
            {
                result.Count.Should().Be(2);
                result[0].PromptNumber.Should().Be(1);
                result[1].PromptNumber.Should().Be(2);
            }
        }
Esempio n. 2
0
        public IActionResult Index(int delegateId)
        {
            var centreId         = User.GetCentreId();
            var delegateUser     = userDataService.GetDelegateUserCardById(delegateId) !;
            var categoryIdFilter = User.GetAdminCourseCategoryFilter();

            var customFields    = promptsService.GetDelegateRegistrationPromptsForCentre(centreId, delegateUser);
            var delegateCourses =
                courseService.GetAllCoursesInCategoryForDelegate(delegateId, centreId, categoryIdFilter);

            var model = new ViewDelegateViewModel(delegateUser, customFields, delegateCourses);

            return(View(model));
        }