Esempio n. 1
0
        public InitialMenuViewModel(CourseContent courseContent)
        {
            Id              = courseContent.Id;
            Title           = courseContent.Title;
            Description     = courseContent.Description;
            AverageDuration = DurationFormattingHelper.FormatNullableDuration(courseContent.AverageDuration);

            CentreName = courseContent.CentreName;
            BannerText = courseContent.BannerText;
            ShouldShowCompletionSummary = courseContent.IncludeCertification;
            Sections = courseContent.Sections.Select(section => new SectionCardViewModel(
                                                         section,
                                                         Id,
                                                         courseContent.CourseSettings.ShowPercentage
                                                         ));
            CompletionSummaryCardViewModel = new CompletionSummaryCardViewModel(
                courseContent.Id,
                courseContent.Completed,
                courseContent.MaxPostLearningAssessmentAttempts,
                courseContent.IsAssessed,
                courseContent.PostLearningAssessmentPassThreshold,
                courseContent.DiagnosticAssessmentCompletionThreshold,
                courseContent.TutorialsCompletionThreshold
                );
            ShowTime = AverageDuration != null && courseContent.CourseSettings.ShowTime;
        }
Esempio n. 2
0
        public void FormatNullableDuration_should_format_durations(int?duration, string?expectedResult)
        {
            // When
            var result = DurationFormattingHelper.FormatNullableDuration(duration);

            // Then
            result.Should().Be(expectedResult);
        }
 public TutorialTimeSummaryViewModel(
     int timeSpent,
     int averageTimeSpent,
     bool showTimeSetting,
     bool showLearnStatusSetting
     )
 {
     TimeSpentSummary   = DurationFormattingHelper.FormatDuration(timeSpent);
     AverageTimeSummary = DurationFormattingHelper.FormatDuration(averageTimeSpent);
     ShowTime           = showTimeSetting && showLearnStatusSetting;
 }
Esempio n. 4
0
        public void FormatDuration_should_have_duration_for_0_minutes()
        {
            // Given
            const int duration = 0;

            // When
            var result = DurationFormattingHelper.FormatDuration(duration);

            // Then
            result.Should().Be("0 minutes");
        }
Esempio n. 5
0
        public void FormatDuration_should_have_duration_for_multiple_hours()
        {
            // Given
            const int duration = 195;

            // When
            var result = DurationFormattingHelper.FormatDuration(duration);

            // Then
            result.Should().Be("3 hours 15 minutes");
        }
Esempio n. 6
0
        public void FormatDuration_should_have_duration_for_one_hour_one_minute()
        {
            // Given
            const int duration = 61;

            // When
            var result = DurationFormattingHelper.FormatDuration(duration);

            // Then
            result.Should().Be("1 hour 1 minute");
        }
Esempio n. 7
0
        public void FormatDuration_should_have_duration_for_whole_number_of_hours()
        {
            // Given
            const int duration = 120;

            // When
            var result = DurationFormattingHelper.FormatDuration(duration);

            // Then
            result.Should().Be("2 hours");
        }