コード例 #1
0
        public void Post_learning_content_should_render_view()
        {
            // Given
            const int progressId = 299;
            var       defaultPostLearningContent = PostLearningAssessmentTestHelper.CreateDefaultPostLearningContent();

            A.CallTo(() => postLearningAssessmentService.GetPostLearningContent(CustomisationId, SectionId))
            .Returns(defaultPostLearningContent);
            A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, CustomisationId, CentreId)).
            Returns(progressId);

            // When
            var result = controller.PostLearningContent(CustomisationId, SectionId);

            // Then
            var expectedModel = new PostLearningContentViewModel(
                config,
                defaultPostLearningContent,
                CustomisationId,
                CentreId,
                SectionId,
                progressId,
                CandidateId);

            result.Should().BeViewResult()
            .Model.Should().BeEquivalentTo(expectedModel);
        }
コード例 #2
0
        public void Post_learning_content_should_parse_scorm_url()
        {
            // Given
            const int    currentVersion           = 55;
            const string diagnosticAssessmentPath = "https://www.dls.nhs.uk/CMS/CMSContent/Course38/PLAssess/04_Digital_Literacy_PL/imsmanifest.xml";
            var          postLearningContent      = PostLearningAssessmentTestHelper.CreateDefaultPostLearningContent(
                postLearningAssessmentPath: diagnosticAssessmentPath,
                currentVersion: currentVersion
                );

            // When
            var postLearningContentViewModel = new PostLearningContentViewModel(
                config,
                postLearningContent,
                CustomisationId,
                CentreId,
                SectionId,
                ProgressId,
                CandidateId
                );

            // Then
            postLearningContentViewModel.ContentSource.Should().Be(
                $"{BaseUrl}/scoplayer/sco?CentreID=6&CustomisationID=5&CandidateID=8&SectionID=7&Version=55" +
                "&tutpath=https://www.dls.nhs.uk/CMS/CMSContent/Course38/PLAssess/04_Digital_Literacy_PL/imsmanifest.xml&type=pl"
                );
        }
コード例 #3
0
        public void Post_learning_content_should_parse_html_url()
        {
            // Given
            const int    currentVersion            = 55;
            const int    postLearningPassThreshold = 77;
            const string diagnosticAssessmentPath  = "https://www.dls.nhs.uk/CMS/CMSContent/Course120/PLAssess/03-PLA-Working-with-files/itspplayer.html";
            var          postLearningContent       = PostLearningAssessmentTestHelper.CreateDefaultPostLearningContent(
                postLearningAssessmentPath: diagnosticAssessmentPath,
                postLearningPassThreshold: postLearningPassThreshold,
                currentVersion: currentVersion
                );

            postLearningContent.Tutorials.AddRange(new[] { 1, 2, 3 });

            // When
            var postLearningContentViewModel = new PostLearningContentViewModel(
                config,
                postLearningContent,
                CustomisationId,
                CentreId,
                SectionId,
                ProgressId,
                CandidateId
                );

            // Then
            postLearningContentViewModel.ContentSource.Should().Be(
                "https://www.dls.nhs.uk/CMS/CMSContent/Course120/PLAssess/03-PLA-Working-with-files/itspplayer.html" +
                "?CentreID=6&CustomisationID=5&CandidateID=8&SectionID=7&Version=55&ProgressID=9" +
                $"&type=pl&TrackURL={BaseUrl}/tracking/tracker&objlist=[1,2,3]&plathresh=77"
                );
        }
コード例 #4
0
        public void Post_learning_content_should_not_StartOrUpdate_course_sessions_if_unable_to_enrol()
        {
            // Given
            var defaultPostLearningContent = PostLearningAssessmentTestHelper.CreateDefaultPostLearningContent();

            A.CallTo(() => postLearningAssessmentService.GetPostLearningContent(CustomisationId, SectionId))
            .Returns(defaultPostLearningContent);
            A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, CustomisationId, CentreId))
            .Returns(null);

            // When
            controller.PostLearningContent(CustomisationId, SectionId);

            // Then
            A.CallTo(() => sessionService.StartOrUpdateDelegateSession(A <int> ._, A <int> ._, A <ISession> ._)).MustNotHaveHappened();
        }
コード例 #5
0
        public void Post_learning_content_should_UpdateProgress_if_valid_post_learning_content()
        {
            // Given
            const int progressId = 299;
            var       defaultPostLearningContent = PostLearningAssessmentTestHelper.CreateDefaultPostLearningContent();

            A.CallTo(() => postLearningAssessmentService.GetPostLearningContent(CustomisationId, SectionId))
            .Returns(defaultPostLearningContent);
            A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, CustomisationId, CentreId))
            .Returns(progressId);

            // When
            controller.PostLearningContent(CustomisationId, SectionId);

            // Then
            A.CallTo(() => courseContentService.UpdateProgress(progressId)).MustHaveHappened();
        }
コード例 #6
0
        public void Post_learning_content_should_404_if_failed_to_enrol()
        {
            // Given
            var defaultPostLearningContent = PostLearningAssessmentTestHelper.CreateDefaultPostLearningContent();

            A.CallTo(() => postLearningAssessmentService.GetPostLearningContent(CustomisationId, SectionId))
            .Returns(defaultPostLearningContent);
            A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, CustomisationId, CentreId)).Returns(null);

            // When
            var result = controller.PostLearningContent(CustomisationId, SectionId);

            // Then
            result.Should()
            .BeRedirectToActionResult()
            .WithControllerName("LearningSolutions")
            .WithActionName("StatusCode")
            .WithRouteValue("code", 404);
        }
コード例 #7
0
        public void Post_learning_content_should_have_customisation_id()
        {
            // Given
            const int customisationId     = 11;
            var       postLearningContent = PostLearningAssessmentTestHelper.CreateDefaultPostLearningContent();

            // When
            var postLearningContentViewModel = new PostLearningContentViewModel(
                config,
                postLearningContent,
                customisationId,
                CentreId,
                SectionId,
                ProgressId,
                CandidateId
                );

            // Then
            postLearningContentViewModel.CustomisationId.Should().Be(customisationId);
        }
コード例 #8
0
        public void Post_learning_content_should_StartOrUpdate_course_sessions_if_valid_post_learning_content()
        {
            // Given
            const int progressId = 299;
            var       defaultPostLearningContent = PostLearningAssessmentTestHelper.CreateDefaultPostLearningContent();

            A.CallTo(() => postLearningAssessmentService.GetPostLearningContent(CustomisationId, SectionId))
            .Returns(defaultPostLearningContent);
            A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, CustomisationId, CentreId))
            .Returns(progressId);

            // When
            controller.PostLearningContent(CustomisationId, SectionId);

            // Then
            A.CallTo(() => sessionService.StartOrUpdateDelegateSession(CandidateId, CustomisationId, httpContextSession)).MustHaveHappenedOnceExactly();
            A.CallTo(() => sessionService.StartOrUpdateDelegateSession(A <int> ._, A <int> ._, A <ISession> ._))
            .WhenArgumentsMatch((int candidateId, int customisationId, ISession session) =>
                                candidateId != CandidateId || customisationId != CustomisationId)
            .MustNotHaveHappened();
        }
コード例 #9
0
        public void Post_learning_content_should_have_section_name()
        {
            // Given
            const string sectionName         = "Section name";
            var          postLearningContent = PostLearningAssessmentTestHelper.CreateDefaultPostLearningContent(
                sectionName: sectionName
                );

            // When
            var postLearningContentViewModel = new PostLearningContentViewModel(
                config,
                postLearningContent,
                CustomisationId,
                CentreId,
                SectionId,
                ProgressId,
                CandidateId
                );

            // Then
            postLearningContentViewModel.SectionName.Should().Be(sectionName);
        }
コード例 #10
0
        public void Post_learning_content_should_have_title()
        {
            // Given
            const string applicationName     = "Application name";
            const string customisationName   = "Customisation name";
            var          postLearningContent = PostLearningAssessmentTestHelper.CreateDefaultPostLearningContent(
                applicationName: applicationName,
                customisationName: customisationName
                );

            // When
            var postLearningContentViewModel = new PostLearningContentViewModel(
                config,
                postLearningContent,
                CustomisationId,
                CentreId,
                SectionId,
                ProgressId,
                CandidateId
                );

            // Then
            postLearningContentViewModel.CourseTitle.Should().Be($"{applicationName} - {customisationName}");
        }