コード例 #1
0
 public TutorialTimeSummaryViewModel(
     int timeSpent,
     int averageTimeSpent,
     bool showTimeSetting,
     bool showLearnStatusSetting
     )
 {
     TimeSpentSummary   = DurationFormattingHelper.FormatDuration(timeSpent);
     AverageTimeSummary = DurationFormattingHelper.FormatDuration(averageTimeSpent);
     ShowTime           = showTimeSetting && showLearnStatusSetting;
 }
コード例 #2
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");
        }
コード例 #3
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");
        }
コード例 #4
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");
        }
コード例 #5
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");
        }