public void Tutorial_separator_displays_in_correct_situations( bool showTutorials, bool showPostLearningAssessment, bool showConsolidationExercise, bool separatorExpected ) { // Given var consolidationPath = showConsolidationExercise ? "https://www.dls.nhs.uk/tracking/MOST/Word07Core/cons/WC07-Exercise_1.zip" : null; var sectionContent = SectionContentHelper.CreateDefaultSectionContent( isAssessed: showPostLearningAssessment, consolidationPath: consolidationPath ); if (showTutorials) { var tutorials = new[] { SectionTutorialHelper.CreateDefaultSectionTutorial(), SectionTutorialHelper.CreateDefaultSectionTutorial() }; sectionContent.Tutorials.AddRange(tutorials); } // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.DisplayTutorialSeparator.Should().Be(separatorExpected); }
public void Section_should_return_section_page_if_more_than_one_tutorial_in_section() { // Given const int customisationId = 123; const int sectionId = 456; const int tutorialId = 789; var tutorial1 = SectionContentHelper.CreateDefaultSectionTutorial(id: tutorialId + 1); var tutorial2 = SectionContentHelper.CreateDefaultSectionTutorial(id: tutorialId + 2); var tutorial3 = SectionContentHelper.CreateDefaultSectionTutorial(id: tutorialId + 3); var expectedSectionContent = SectionContentHelper.CreateDefaultSectionContent( diagAssessPath: null, plAssessPath: null, consolidationPath: null, otherSectionsExist: true ); expectedSectionContent.Tutorials.AddRange(new[] { tutorial1, tutorial2, tutorial3 }); A.CallTo(() => sectionContentDataService.GetSectionContent(customisationId, CandidateId, sectionId)) .Returns(expectedSectionContent); A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, customisationId, CentreId)).Returns(10); var expectedModel = new SectionContentViewModel(config, expectedSectionContent, customisationId, sectionId); // When var result = controller.Section(customisationId, sectionId); // Then result.Should().BeViewResult() .Model.Should().BeEquivalentTo(expectedModel); }
public void Section_should_return_section_page_if_there_is_diagnostic_assessment_and_consolidation() { // Given const int customisationId = 123; const int sectionId = 456; var expectedSectionContent = SectionContentHelper.CreateDefaultSectionContent( diagAssessPath: "some/diagnostic/path.html", diagStatus: true, plAssessPath: null, consolidationPath: "some/consolidation/path.pdf", otherSectionsExist: true ); // expectedSectionContent.Tutorials; viewable tutorials, is empty A.CallTo(() => sectionContentDataService.GetSectionContent(customisationId, CandidateId, sectionId)) .Returns(expectedSectionContent); A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, customisationId, CentreId)).Returns(10); var expectedModel = new SectionContentViewModel(config, expectedSectionContent, customisationId, sectionId); // When var result = controller.Section(customisationId, sectionId); // Then result.Should().BeViewResult() .Model.Should().BeEquivalentTo(expectedModel); }
public void Section_should_redirect_to_tutorial_page_if_one_tutorial_and_is_assessed_but_has_no_path() { // Given const int customisationId = 123; const int sectionId = 456; const int tutorialId = 789; var tutorial = SectionContentHelper.CreateDefaultSectionTutorial(id: tutorialId); var expectedSectionContent = SectionContentHelper.CreateDefaultSectionContent( diagAssessPath: null, plAssessPath: null, isAssessed: true, consolidationPath: null, otherSectionsExist: true ); expectedSectionContent.Tutorials.Add(tutorial); A.CallTo(() => sectionContentDataService.GetSectionContent(customisationId, CandidateId, sectionId)) .Returns(expectedSectionContent); A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, customisationId, CentreId)).Returns(10); // When var result = controller.Section(customisationId, sectionId); // Then result.Should() .BeRedirectToActionResult() .WithControllerName("LearningMenu") .WithActionName("Tutorial") .WithRouteValue("customisationId", customisationId) .WithRouteValue("sectionId", sectionId) .WithRouteValue("tutorialId", tutorialId); }
public void Section_should_return_section_page_if_there_is_post_learning_assessment_and_tutorial() { // Given const int customisationId = 123; const int sectionId = 456; const int tutorialId = 789; var tutorial = SectionContentHelper.CreateDefaultSectionTutorial(id: tutorialId); var expectedSectionContent = SectionContentHelper.CreateDefaultSectionContent( diagAssessPath: null, plAssessPath: "some/post-learning/path.html", isAssessed: true, consolidationPath: null, otherSectionsExist: true ); expectedSectionContent.Tutorials.Add(tutorial); A.CallTo(() => sectionContentDataService.GetSectionContent(customisationId, CandidateId, sectionId)) .Returns(expectedSectionContent); A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, customisationId, CentreId)).Returns(10); var expectedModel = new SectionContentViewModel(config, expectedSectionContent, customisationId, sectionId); // When var result = controller.Section(customisationId, sectionId); // Then result.Should().BeViewResult() .Model.Should().BeEquivalentTo(expectedModel); }
public void Section_should_redirect_to_diagnostic_assessment_if_is_assessed_but_there_is_no_post_learning_path() { // Given const int customisationId = 123; const int sectionId = 456; var expectedSectionContent = SectionContentHelper.CreateDefaultSectionContent( diagAssessPath: "some/diagnostic/path.html", diagStatus: true, plAssessPath: null, isAssessed: true, consolidationPath: null, otherSectionsExist: true ); // expectedSectionContent.Tutorials; viewable tutorials, is empty A.CallTo(() => sectionContentDataService.GetSectionContent(customisationId, CandidateId, sectionId)) .Returns(expectedSectionContent); A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, customisationId, CentreId)).Returns(10); // When var result = controller.Section(customisationId, sectionId); // Then result.Should() .BeRedirectToActionResult() .WithControllerName("LearningMenu") .WithActionName("Diagnostic") .WithRouteValue("customisationId", customisationId) .WithRouteValue("sectionId", sectionId); }
public void Section_content_post_learning_passed_should_be_false_if_pl_passes_is_zero() { // When var sectionContent = SectionContentHelper.CreateDefaultSectionContent(plPasses: 0); // Then sectionContent.PostLearningPassed.Should().BeFalse(); }
public void Section_content_post_learning_passed_should_be_true_if_pl_passes_is_more_than_one() { // When var sectionContent = SectionContentHelper.CreateDefaultSectionContent(plPasses: 3); // Then sectionContent.PostLearningPassed.Should().BeTrue(); }
public void Section_content_should_have_customisation_id() { // Given var sectionContent = SectionContentHelper.CreateDefaultSectionContent(); // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.CustomisationId.Should().Be(CustomisationId); }
public void Diagnostic_assessment_should_not_be_shown_if_diag_status_is_false() { // Given var sectionContent = SectionContentHelper.CreateDefaultSectionContent(diagStatus: false); // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.ShowDiagnostic.Should().BeFalse(); }
public void Post_learning_status_should_have_passed_styling_if_pl_attempts_is_more_than_zero_and_pl_passes_is_more_than_zero() { // Given var sectionContent = SectionContentHelper.CreateDefaultSectionContent(attemptsPl: 3, plPasses: 1); // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.PostLearningStatusStyling.Should().Be("passed-text"); }
public void Post_learning_should_not_be_shown_if_is_assessed_is_false() { // Given var sectionContent = SectionContentHelper.CreateDefaultSectionContent(isAssessed: false); // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.ShowPostLearning.Should().BeFalse(); }
public void Post_learning_should_not_be_shown_if_no_post_learning_path() { // Given var sectionContent = SectionContentHelper.CreateDefaultSectionContent(plAssessPath: null); // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.ShowPostLearning.Should().BeFalse(); }
public void Post_learning_status_should_be_not_attempted_if_pl_attempts_is_zero() { // Given var sectionContent = SectionContentHelper.CreateDefaultSectionContent(attemptsPl: 0); // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.PostLearningStatus.Should().Be("Not Attempted"); }
public void Diagnostic_assessment_completion_status_is_not_attempted_if_diag_attempts_is_zero() { // Given var sectionContent = SectionContentHelper.CreateDefaultSectionContent(diagAttempts: 0); // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.DiagnosticCompletionStatus.Should().Be("Not Attempted"); }
public void Diagnostic_assessment_should_be_shown_if_diag_status_is_true_and_diag_assessment_path_exists() { // Given var sectionContent = SectionContentHelper.CreateDefaultSectionContent( diagAssessPath: "https://www.dls.nhs.uk/CMS/CMSContent/Course308/Diagnostic/02-DIAG-Entering-data/itspplayer.html", diagStatus: true); // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.ShowDiagnostic.Should().BeTrue(); }
public void Post_learning_should_be_shown_if_there_is_post_learning_path_and_is_assessed_is_true() { // Given var sectionContent = SectionContentHelper.CreateDefaultSectionContent( plAssessPath: "https://www.dls.nhs.uk/CMS/CMSContent/Course308/PLAssess/02-PLA-Entering-data/itspplayer.html", isAssessed: true); // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.ShowPostLearning.Should().BeTrue(); }
public void Section_content_should_have_default_consolidationExerciseLabel_when_courseSetting_is_empty() { // Given var sectionContent = SectionContentHelper.CreateDefaultSectionContent( courseSettings: null ); // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.ConsolidationExerciseLabel.Should().Be("Consolidation Exercise"); }
public void Should_have_null_next_section_id_if_there_is_no_next_section() { // Given var sectionContent = SectionContentHelper.CreateDefaultSectionContent( nextSectionId: null ); // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.NextSectionId.Should().BeNull(); }
public void Section_content_should_not_have_otherSectionsExist_when_no_other_sections_exist() { // Given var sectionContent = SectionContentHelper.CreateDefaultSectionContent( otherSectionsExist: false ); // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.OtherSectionsExist.Should().BeFalse(); }
public void Section_content_should_not_show_completion_summary_when_other_sections_exist() { // Given var sectionContent = SectionContentHelper.CreateDefaultSectionContent( otherSectionsExist: true, includeCertification: true ); // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.ShowCompletionSummary.Should().BeFalse(); }
public void Section_content_should_have_consolidationExerciseLabel_from_courseSetting() { // Given const string consolidationText = "Different consolidation description"; var sectionContent = SectionContentHelper.CreateDefaultSectionContent( courseSettings: "{\"lm.ce\":\"" + consolidationText + "\"}" ); // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.ConsolidationExerciseLabel.Should().Be(consolidationText); }
public void Section_content_should_have_section_name() { // Given const string sectionName = "Section name"; var sectionContent = SectionContentHelper.CreateDefaultSectionContent( sectionName: sectionName ); // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.SectionName.Should().Be(sectionName); }
public void Section_content_view_model_should_properly_convert_consolidation_path() { // Given const string consolidationPath = "consolidation/path"; var sectionContent = SectionContentHelper.CreateDefaultSectionContent( consolidationPath: consolidationPath ); var expectedConsolidationPath = $"{BaseUrl}/tracking/dlconsolidation?client={consolidationPath}"; // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.ConsolidationExercisePath.Should().Be(expectedConsolidationPath); }
public void Section_content_should_have_title() { // Given const string applicationName = "Application name"; const string customisationName = "Customisation name"; var sectionContent = SectionContentHelper.CreateDefaultSectionContent( applicationName: applicationName, customisationName: customisationName ); // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.CourseTitle.Should().Be($"{applicationName} - {customisationName}"); }
public void Section_should_not_StartOrUpdate_course_sessions_if_unable_to_enrol() { // Given var defaultSectionContent = SectionContentHelper.CreateDefaultSectionContent(); A.CallTo(() => sectionContentDataService.GetSectionContent(CustomisationId, CandidateId, SectionId)) .Returns(defaultSectionContent); A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, CustomisationId, CentreId)) .Returns(null); // When controller.Section(CustomisationId, SectionId); // Then A.CallTo(() => sessionService.StartOrUpdateDelegateSession(A <int> ._, A <int> ._, A <ISession> ._)).MustNotHaveHappened(); }
public void Section_should_UpdateProgress_if_valid_section() { // Given const int progressId = 299; var defaultSectionContent = SectionContentHelper.CreateDefaultSectionContent(); A.CallTo(() => sectionContentDataService.GetSectionContent(CustomisationId, CandidateId, SectionId)) .Returns(defaultSectionContent); A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, CustomisationId, CentreId)) .Returns(progressId); // When controller.Section(CustomisationId, SectionId); // Then A.CallTo(() => courseContentService.UpdateProgress(progressId)).MustHaveHappened(); }
public void Diagnostic_assessment_completion_status_does_not_use_plural_if_attempts_is_one() { // Given const int diagAttempts = 1; const int secScore = 10; const int secOutOf = 15; var sectionContent = SectionContentHelper.CreateDefaultSectionContent( diagAttempts: diagAttempts, secScore: secScore, secOutOf: secOutOf); // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.DiagnosticCompletionStatus.Should().Be($"{secScore}/{secOutOf} - {diagAttempts} attempt"); }
public void Diagnostic_assessment_completion_status_shows_score_and_attempts_if_diag_attempts_is_more_than_0() { // Given const int diagAttempts = 4; const int secScore = 10; const int secOutOf = 15; var sectionContent = SectionContentHelper.CreateDefaultSectionContent( diagAttempts: diagAttempts, secScore: secScore, secOutOf: secOutOf); // When var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId); // Then sectionContentViewModel.DiagnosticCompletionStatus.Should().Be($"{secScore}/{secOutOf} - {diagAttempts} attempts"); }
public void Section_should_404_if_failed_to_enrol() { // Given var defaultSectionContent = SectionContentHelper.CreateDefaultSectionContent(); A.CallTo(() => sectionContentDataService.GetSectionContent(CustomisationId, CandidateId, SectionId)) .Returns(defaultSectionContent); A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, CustomisationId, CentreId)).Returns(null); // When var result = controller.Section(CustomisationId, SectionId); // Then result.Should() .BeRedirectToActionResult() .WithControllerName("LearningSolutions") .WithActionName("StatusCode") .WithRouteValue("code", 404); }