Exemple #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);
        }
Exemple #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"
                );
        }
Exemple #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"
                );
        }
Exemple #4
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);
        }
Exemple #5
0
        public IActionResult PostLearningContent(int customisationId, int sectionId)
        {
            var candidateId         = User.GetCandidateIdKnownNotNull();
            var centreId            = User.GetCentreId();
            var postLearningContent = postLearningAssessmentService.GetPostLearningContent(customisationId, sectionId);

            if (postLearningContent == null)
            {
                logger.LogError(
                    "Redirecting to 404 as customisation/section/centre id was not found. " +
                    $"Candidate id: {candidateId}, customisation id: {customisationId}, " +
                    $"centre id: {centreId.ToString() ?? "null"}, section id: {sectionId}");
                return(RedirectToAction("StatusCode", "LearningSolutions", new { code = 404 }));
            }

            var progressId = courseContentService.GetOrCreateProgressId(candidateId, customisationId, centreId);

            if (progressId == null)
            {
                logger.LogError(
                    "Redirecting to 404 as no progress id was returned. " +
                    $"Candidate id: {candidateId}, customisation id: {customisationId}, centre id: {centreId}");
                return(RedirectToAction("StatusCode", "LearningSolutions", new { code = 404 }));
            }

            sessionService.StartOrUpdateDelegateSession(candidateId, customisationId, HttpContext.Session);
            courseContentService.UpdateProgress(progressId.Value);

            var model = new PostLearningContentViewModel(
                config,
                postLearningContent,
                customisationId,
                centreId,
                sectionId,
                progressId.Value,
                candidateId
                );

            return(View("PostLearning/PostLearningContent", model));
        }
Exemple #6
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);
        }
Exemple #7
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}");
        }