Esempio n. 1
0
        TestFormatDuration()
        {
            TimeSpan oDuration = new TimeSpan(0);

            Assert.AreEqual("0-minute",
                            DateTimeUtil2.FormatDuration(oDuration));
        }
Esempio n. 2
0
        TestFormatDuration2()
        {
            // Hours, minutes, seconds.
            TimeSpan oDuration = new TimeSpan(0, 0, 1);

            Assert.AreEqual("0-minute",
                            DateTimeUtil2.FormatDuration(oDuration));
        }
Esempio n. 3
0
        TestFormatDuration14()
        {
            // Hours, minutes, seconds.
            TimeSpan oDuration = new TimeSpan(123, 19, 44);

            Assert.AreEqual("5-day, 3-hour, 19-minute",
                            DateTimeUtil2.FormatDuration(oDuration));
        }
Esempio n. 4
0
        TestFormatDuration13()
        {
            // Hours, minutes, seconds.
            TimeSpan oDuration = new TimeSpan(26, 12, 14);

            Assert.AreEqual("1-day, 2-hour, 12-minute",
                            DateTimeUtil2.FormatDuration(oDuration));
        }
Esempio n. 5
0
        TestFormatDuration11()
        {
            // Hours, minutes, seconds.
            TimeSpan oDuration = new TimeSpan(25, 59, 48);

            Assert.AreEqual("1-day, 1-hour, 59-minute",
                            DateTimeUtil2.FormatDuration(oDuration));
        }
Esempio n. 6
0
        TestFormatDuration7()
        {
            // Hours, minutes, seconds.
            TimeSpan oDuration = new TimeSpan(24, 0, 0);

            Assert.AreEqual("1-day, 0-hour, 0-minute",
                            DateTimeUtil2.FormatDuration(oDuration));
        }
Esempio n. 7
0
        TestFormatDuration6()
        {
            // Hours, minutes, seconds.
            TimeSpan oDuration = new TimeSpan(23, 43, 59);

            Assert.AreEqual("23-hour, 43-minute",
                            DateTimeUtil2.FormatDuration(oDuration));
        }
Esempio n. 8
0
        TestFormatDurationBad()
        {
            // Negative duration.

            // Hours, minutes, seconds.
            TimeSpan oDuration = new TimeSpan(-123, -19, -44);

            DateTimeUtil2.FormatDuration(oDuration);
        }
Esempio n. 9
0
        FormatDuration
        (
            DateTime startOfPeriodUtc,
            DateTime endOfPeriodUtc
        )
        {
            AssertValid();

            TimeSpan oDuration = endOfPeriodUtc - startOfPeriodUtc;

            return(oDuration.Ticks < 0 ? String.Empty :
                   DateTimeUtil2.FormatDuration(oDuration));
        }