Beispiel #1
0
        public void GetDelegateAttemptsAndCourseCustomPrompts_should_call_correct_data_service_and_helper_methods()
        {
            // Given
            const int delegateId      = 20;
            const int customisationId = 111;
            var       attemptStatsReturnedByDataService = new AttemptStats(10, 5);
            var       info = new DelegateCourseInfo
            {
                DelegateId = delegateId, CustomisationId = customisationId, IsAssessed = true
            };

            A.CallTo(() => courseDataService.GetDelegateCourseAttemptStats(delegateId, customisationId))
            .Returns(attemptStatsReturnedByDataService);

            // When
            var results = courseService.GetDelegateAttemptsAndCourseCustomPrompts(info);

            // Then
            A.CallTo(
                () => courseAdminFieldsService.GetCustomPromptsWithAnswersForCourse(
                    info,
                    customisationId
                    )
                ).MustHaveHappenedOnceExactly();
            A.CallTo(() => courseDataService.GetDelegateCourseAttemptStats(delegateId, customisationId))
            .MustHaveHappenedOnceExactly();
            results.DelegateCourseInfo.Should().BeEquivalentTo(info);
            results.AttemptStats.Should().Be(attemptStatsReturnedByDataService);
        }
Beispiel #2
0
        public DelegateCourseDetails GetDelegateAttemptsAndCourseCustomPrompts(
            DelegateCourseInfo info
            )
        {
            var customPrompts = courseAdminFieldsService.GetCustomPromptsWithAnswersForCourse(
                info,
                info.CustomisationId
                );

            var attemptStats = info.IsAssessed
                ? courseDataService.GetDelegateCourseAttemptStats(info.DelegateId, info.CustomisationId)
                : new AttemptStats(0, 0);

            return(new DelegateCourseDetails(info, customPrompts, attemptStats));
        }