コード例 #1
0
        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);
        }
コード例 #2
0
        public void Tutorial_card_should_have_timeSummary(
            int timeSpent,
            int averageTutorialDuration,
            bool showTime,
            bool showLearnStatus
            )
        {
            // Given
            var sectionTutorial = SectionTutorialHelper.CreateDefaultSectionTutorial(
                tutTime: timeSpent,
                averageTutMins: averageTutorialDuration
                );
            var expectedTimeSummary = new TutorialTimeSummaryViewModel(
                timeSpent,
                averageTutorialDuration,
                showTime,
                showLearnStatus
                );

            // When
            var tutorialCardViewModel = new TutorialCardViewModel(
                sectionTutorial,
                showTime,
                showLearnStatus,
                CustomisationId,
                SectionId
                );

            // Then
            tutorialCardViewModel.TimeSummary.Should().BeEquivalentTo(expectedTimeSummary);
        }
コード例 #3
0
        public void Tutorial_card_should_have_customisation_id()
        {
            // Given
            var sectionTutorial = SectionTutorialHelper.CreateDefaultSectionTutorial();

            // When
            var tutorialCardViewModel = new TutorialCardViewModel(
                sectionTutorial,
                ShowTime,
                ShowLearnStatus,
                CustomisationId,
                SectionId
                );

            // Then
            tutorialCardViewModel.CustomisationId.Should().Be(CustomisationId);
        }
コード例 #4
0
        public void Tutorial_card_should_not_show_learning_status_if_showLearnStatus_is_false()
        {
            // Given
            var sectionTutorial = SectionTutorialHelper.CreateDefaultSectionTutorial();

            // When
            var tutorialCardViewModel = new TutorialCardViewModel(
                sectionTutorial,
                showTime: true,
                showLearnStatus: false,
                CustomisationId,
                SectionId
                );

            // Then
            tutorialCardViewModel.ShowLearnStatus.Should().BeFalse();
        }
コード例 #5
0
        public void Tutorial_card_status_tag_colour_should_be_orange_if_current_score_is_less_than_possible_score()
        {
            // Given
            var sectionTutorial = SectionTutorialHelper.CreateDefaultSectionTutorial(
                currentScore: 7,
                possibleScore: 10
                );

            // When
            var tutorialCardViewModel = new TutorialCardViewModel(
                sectionTutorial,
                ShowTime,
                ShowLearnStatus,
                CustomisationId,
                SectionId
                );

            // Then
            tutorialCardViewModel.StatusTagColour.Should().Be("nhsuk-tag--orange");
        }
コード例 #6
0
        public void Tutorial_card_recommendation_status_should_be_recommended_if_current_score_is_less_than_possible_score()
        {
            // Given
            var sectionTutorial = SectionTutorialHelper.CreateDefaultSectionTutorial(
                currentScore: 7,
                possibleScore: 10
                );

            // When
            var tutorialCardViewModel = new TutorialCardViewModel(
                sectionTutorial,
                ShowTime,
                ShowLearnStatus,
                CustomisationId,
                SectionId
                );

            // Then
            tutorialCardViewModel.RecommendationStatus.Should().Be("Recommended");
        }
コード例 #7
0
        public void Tutorial_card_should_not_show_recommendation_status_if_diagnostic_attempts_is_zero()
        {
            // Given
            var sectionTutorial = SectionTutorialHelper.CreateDefaultSectionTutorial(
                tutorialDiagnosticAttempts: 0,
                tutorialDiagnosticStatus: true
                );

            // When
            var tutorialCardViewModel = new TutorialCardViewModel(
                sectionTutorial,
                ShowTime,
                ShowLearnStatus,
                CustomisationId,
                SectionId
                );

            // Then
            tutorialCardViewModel.ShowRecommendationStatus.Should().BeFalse();
        }
コード例 #8
0
        public void Tutorial_card_should_show_recommendation_status_if_all_conditions_are_met()
        {
            // Given
            var sectionTutorial = SectionTutorialHelper.CreateDefaultSectionTutorial(
                tutorialDiagnosticStatus: true,
                tutorialDiagnosticAttempts: 2
                );

            // When
            var tutorialCardViewModel = new TutorialCardViewModel(
                sectionTutorial,
                ShowTime,
                showLearnStatus: true,
                CustomisationId,
                SectionId
                );

            // Then
            tutorialCardViewModel.ShowRecommendationStatus.Should().BeTrue();
        }
コード例 #9
0
        public void Section_content_with_mixed_status_tutorials_that_need_rounding_returns_correct_percent_complete()
        {
            // Given
            const bool hasLearning = true;
            var        tutorials   = new[]
            {
                SectionTutorialHelper.CreateDefaultSectionTutorial(tutStat: 2),
                SectionTutorialHelper.CreateDefaultSectionTutorial(tutStat: 0),
                SectionTutorialHelper.CreateDefaultSectionTutorial(tutStat: 0)
            };
            const int roundedPercentComplete = 33;
            var       sectionContent         = SectionContentHelper.CreateDefaultSectionContent(hasLearning: hasLearning);

            sectionContent.Tutorials.AddRange(tutorials);

            // When
            var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId);

            // Then
            sectionContentViewModel.PercentComplete.Should().Be($"{roundedPercentComplete}% learning complete");
        }
コード例 #10
0
        public void Section_content_with_all_started_tutorials_should_have_fifty_percent_complete()
        {
            // Given
            const bool hasLearning = true;
            var        tutorials   = new[]
            {
                SectionTutorialHelper.CreateDefaultSectionTutorial(tutStat: 1),
                SectionTutorialHelper.CreateDefaultSectionTutorial(tutStat: 1),
                SectionTutorialHelper.CreateDefaultSectionTutorial(tutStat: 1)
            };
            const int expectedPercentComplete = 50;
            var       sectionContent          = SectionContentHelper.CreateDefaultSectionContent(hasLearning: hasLearning);

            sectionContent.Tutorials.AddRange(tutorials);

            // When
            var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId);

            // Then
            sectionContentViewModel.PercentComplete.Should().Be($"{expectedPercentComplete}% learning complete");
        }
コード例 #11
0
        public void Percent_complete_should_correctly_be_floored()
        {
            // Given
            const bool hasLearning = true;
            var        tutorials   = new[]
            {
                SectionTutorialHelper.CreateDefaultSectionTutorial(tutStat: 2),
                SectionTutorialHelper.CreateDefaultSectionTutorial(tutStat: 2),
                SectionTutorialHelper.CreateDefaultSectionTutorial(tutStat: 0)
            };
            // Percent complete will be 66.666667 which when floored should be 66
            const int roundedPercentComplete = 66;
            var       sectionContent         = SectionContentHelper.CreateDefaultSectionContent(hasLearning: hasLearning);

            sectionContent.Tutorials.AddRange(tutorials);

            // When
            var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId);

            // Then
            sectionContentViewModel.PercentComplete.Should().Be($"{roundedPercentComplete}% learning complete");
        }
コード例 #12
0
        public void Section_content_with_false_showPercentage_course_setting_should_not_show_percent_complete()
        {
            // Given
            const string courseSettings = "{\"lm.sp\":false}"; // ShowPercentage = false
            var          tutorials      = new[]
            {
                SectionTutorialHelper.CreateDefaultSectionTutorial(tutStat: 2),
                SectionTutorialHelper.CreateDefaultSectionTutorial(tutStat: 0),
                SectionTutorialHelper.CreateDefaultSectionTutorial(tutStat: 0)
            };
            var sectionContent = SectionContentHelper.CreateDefaultSectionContent(
                hasLearning: true,
                courseSettings: courseSettings
                );

            sectionContent.Tutorials.AddRange(tutorials);

            // When
            var sectionContentViewModel = new SectionContentViewModel(config, sectionContent, CustomisationId, SectionId);

            // Then
            sectionContentViewModel.ShowPercentComplete.Should().BeFalse();
        }