public void Post_learning_assessment_should_render_view() { // Given const int progressId = 299; var defaultPostLearningAssessment = PostLearningAssessmentHelper.CreateDefaultPostLearningAssessment(); A.CallTo(() => postLearningAssessmentService.GetPostLearningAssessment(CustomisationId, CandidateId, SectionId)) .Returns(defaultPostLearningAssessment); A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, CustomisationId, CentreId)). Returns(progressId); // When var result = controller.PostLearning(CustomisationId, SectionId); // Then var expectedModel = new PostLearningAssessmentViewModel(defaultPostLearningAssessment, CustomisationId, SectionId); result.Should().BeViewResult() .Model.Should().BeEquivalentTo(expectedModel); }
public void Post_learning_assessment_should_StartOrUpdate_course_sessions_if_valid_post_learning_assessment() { // Given const int progressId = 299; var defaultPostLearningAssessment = PostLearningAssessmentHelper.CreateDefaultPostLearningAssessment(); A.CallTo(() => postLearningAssessmentService.GetPostLearningAssessment(CustomisationId, CandidateId, SectionId)) .Returns(defaultPostLearningAssessment); A.CallTo(() => courseContentService.GetOrCreateProgressId(CandidateId, CustomisationId, CentreId)) .Returns(progressId); // When controller.PostLearning(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(); }
public void Post_learning_assessment_should_have_showNextButton( bool otherSectionsExist, bool otherItemsInSectionExist, int attemptsPl, bool expectedShowNextButton ) { // Given var postLearningAssessment = PostLearningAssessmentHelper.CreateDefaultPostLearningAssessment( otherSectionsExist: otherSectionsExist, otherItemsInSectionExist: otherItemsInSectionExist, attemptsPl: attemptsPl ); // When var postLearningAssessmentViewModel = new PostLearningAssessmentViewModel(postLearningAssessment, CustomisationId, SectionId); // Then postLearningAssessmentViewModel.ShowNextButton.Should().Be(expectedShowNextButton); }
public void Post_learning_assessment_should_have_showCompletionSummary( bool otherSectionsExist, bool otherItemsInSectionExist, bool includeCertification, bool expectedShowCompletionSummary ) { // Given var postLearningAssessment = PostLearningAssessmentHelper.CreateDefaultPostLearningAssessment( otherSectionsExist: otherSectionsExist, otherItemsInSectionExist: otherItemsInSectionExist, includeCertification: includeCertification ); // When var postLearningAssessmentViewModel = new PostLearningAssessmentViewModel(postLearningAssessment, CustomisationId, SectionId); // Then postLearningAssessmentViewModel.ShowCompletionSummary.Should().Be(expectedShowCompletionSummary); }
public void Post_learning_assessment_should_have_completion_summary_card_view_model( int customisationId, string?completed, int maxPostLearningAssessmentAttempts, bool isAssessed, int postLearningAssessmentPassThreshold, int diagnosticAssessmentCompletionThreshold, int tutorialsCompletionThreshold ) { // Given var completedDateTime = completed != null?DateTime.Parse(completed) : (DateTime?)null; var postLearningAssessment = PostLearningAssessmentHelper.CreateDefaultPostLearningAssessment( completed: completedDateTime, maxPostLearningAssessmentAttempts: maxPostLearningAssessmentAttempts, isAssessed: isAssessed, postLearningAssessmentPassThreshold: postLearningAssessmentPassThreshold, diagnosticAssessmentCompletionThreshold: diagnosticAssessmentCompletionThreshold, tutorialsCompletionThreshold: tutorialsCompletionThreshold ); var expectedCompletionSummaryViewModel = new CompletionSummaryCardViewModel( customisationId, completedDateTime, maxPostLearningAssessmentAttempts, isAssessed, postLearningAssessmentPassThreshold, diagnosticAssessmentCompletionThreshold, tutorialsCompletionThreshold ); // When var postLearningAssessmentViewModel = new PostLearningAssessmentViewModel(postLearningAssessment, customisationId, SectionId); // Then postLearningAssessmentViewModel.CompletionSummaryCardViewModel .Should().BeEquivalentTo(expectedCompletionSummaryViewModel); }