public void Diagnostic_content_should_have_title() { // Given const string applicationName = "Application name"; const string customisationName = "Customisation name"; var emptySelectedTutorials = new List <int>(); var diagnosticContent = DiagnosticAssessmentTestHelper.CreateDefaultDiagnosticContent( applicationName: applicationName, customisationName: customisationName ); // When var diagnosticContentViewModel = new DiagnosticContentViewModel( config, diagnosticContent, emptySelectedTutorials, CustomisationId, CentreId, SectionId, ProgressId, CandidateId ); // Then diagnosticContentViewModel.CourseTitle.Should().Be($"{applicationName} - {customisationName}"); }
public void Diagnostic_content_should_parse_scorm_url() { // Given const int currentVersion = 55; var emptySelectedTutorials = new List <int>(); const string diagnosticAssessmentPath = "https://www.dls.nhs.uk/CMS/CMSContent/Course38/Diagnostic/03_Digital_Literacy_Diag/imsmanifest.xml"; var diagnosticContent = DiagnosticAssessmentTestHelper.CreateDefaultDiagnosticContent( diagnosticAssessmentPath: diagnosticAssessmentPath, currentVersion: currentVersion ); // When var diagnosticContentViewModel = new DiagnosticContentViewModel( config, diagnosticContent, emptySelectedTutorials, CustomisationId, CentreId, SectionId, ProgressId, CandidateId ); // Then diagnosticContentViewModel.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/Diagnostic/03_Digital_Literacy_Diag/imsmanifest.xml&type=diag" ); }
public void Diagnostic_content_should_parse_html_url_using_all_tutorials_when_can_select_tutorials_is_false() { // Given const int currentVersion = 55; const int postLearningPassThreshold = 77; const string diagnosticAssessmentPath = "https://www.dls.nhs.uk/CMS/CMSContent/Course119/Diagnostic/07DiagnosticTesting/itspplayer.html"; var selectedTutorials = new List <int>(new[] { 1, 2, 3 }); var diagnosticContent = DiagnosticAssessmentTestHelper.CreateDefaultDiagnosticContent( diagnosticAssessmentPath: diagnosticAssessmentPath, postLearningPassThreshold: postLearningPassThreshold, currentVersion: currentVersion, canSelectTutorials: false ); diagnosticContent.Tutorials.AddRange(new[] { 1, 2, 3, 4 }); // When var diagnosticContentViewModel = new DiagnosticContentViewModel( config, diagnosticContent, selectedTutorials, CustomisationId, CentreId, SectionId, ProgressId, CandidateId ); // Then diagnosticContentViewModel.ContentSource.Should().Be( "https://www.dls.nhs.uk/CMS/CMSContent/Course119/Diagnostic/07DiagnosticTesting/itspplayer.html" + "?CentreID=6&CustomisationID=5&CandidateID=8&SectionID=7&Version=55&ProgressID=9" + $"&type=diag&TrackURL={BaseUrl}/tracking/tracker&objlist=[1,2,3,4]&plathresh=77" ); }
public void Diagnostic_content_should_render_view() { // Given const int progressId = 299; var emptySelectedTutorials = new List <int>(); var selectedTutorials = new List <int>(); var defaultDiagnosticContent = DiagnosticAssessmentTestHelper.CreateDefaultDiagnosticContent(); A.CallTo(() => diagnosticAssessmentService.GetDiagnosticContent(CustomisationId, SectionId, emptySelectedTutorials)) .Returns(defaultDiagnosticContent); A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, CustomisationId, CentreId)). Returns(progressId); // When var result = controller.DiagnosticContent(CustomisationId, SectionId, emptySelectedTutorials); // Then var expectedModel = new DiagnosticContentViewModel( config, defaultDiagnosticContent, selectedTutorials, CustomisationId, CentreId, SectionId, progressId, CandidateId); result.Should().BeViewResult() .Model.Should().BeEquivalentTo(expectedModel); }
public IActionResult DiagnosticContent(int customisationId, int sectionId, List <int> checkedTutorials) { var candidateId = User.GetCandidateIdKnownNotNull(); var centreId = User.GetCentreId(); var diagnosticContent = diagnosticAssessmentService.GetDiagnosticContent(customisationId, sectionId, checkedTutorials); if (diagnosticContent == 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 DiagnosticContentViewModel( config, diagnosticContent, checkedTutorials, customisationId, centreId, sectionId, progressId.Value, candidateId ); return(View("Diagnostic/DiagnosticContent", model)); }
public void Diagnostic_content_should_have_customisation_id() { // Given const int customisationId = 11; var emptySelectedTutorials = new List <int>(); var diagnosticContent = DiagnosticAssessmentTestHelper.CreateDefaultDiagnosticContent(); // When var diagnosticContentViewModel = new DiagnosticContentViewModel( config, diagnosticContent, emptySelectedTutorials, customisationId, CentreId, SectionId, ProgressId, CandidateId ); // Then diagnosticContentViewModel.CustomisationId.Should().Be(customisationId); }
public void Diagnostic_content_should_have_section_name() { // Given const string sectionName = "Section name"; var emptySelectedTutorials = new List <int>(); var diagnosticContent = DiagnosticAssessmentTestHelper.CreateDefaultDiagnosticContent( sectionName: sectionName ); // When var diagnosticContentViewModel = new DiagnosticContentViewModel( config, diagnosticContent, emptySelectedTutorials, CustomisationId, CentreId, SectionId, ProgressId, CandidateId ); // Then diagnosticContentViewModel.SectionName.Should().Be(sectionName); }