Beispiel #1
0
        public void FormatDateTime()
        {
            DateTime testTime = new DateTime(2007 /*Year*/, 08 /*Month*/, 20 /*Day*/, 10 /*Hour*/, 42 /*Minutes*/, 44 /*Seconds*/, 12 /*Milliseconds*/);
            string   result   = LogFormatter.FormatLogTimeStamp(testTime);

            Assert.Equal(testTime.ToString("HH:mm:ss.fff", CultureInfo.CurrentCulture), result);

            testTime = new DateTime(2007, 08, 20, 05, 04, 03, 01);
            result   = LogFormatter.FormatLogTimeStamp(testTime);
            Assert.Equal(testTime.ToString("HH:mm:ss.fff", CultureInfo.CurrentCulture), result);

            testTime = new DateTime(2007, 08, 20, 0, 0, 0, 0);
            result   = LogFormatter.FormatLogTimeStamp(testTime);
            Assert.Equal(testTime.ToString("HH:mm:ss.fff", CultureInfo.CurrentCulture), result);
        }
Beispiel #2
0
        public void FormatDateTime()
        {
            DateTime testTime = new DateTime(2007 /*Year*/, 08 /*Month*/, 20 /*Day*/, 10 /*Hour*/, 42 /*Minutes*/, 44 /*Seconds*/, 12 /*Milliseconds*/);
            string   result   = LogFormatter.FormatLogTimeStamp(testTime);

            Assertion.AssertEquals("10:42:44.012", result);

            testTime = new DateTime(2007, 08, 20, 05, 04, 03, 01);
            result   = LogFormatter.FormatLogTimeStamp(testTime);
            Assertion.AssertEquals("05:04:03.001", result);

            testTime = new DateTime(2007, 08, 20, 0, 0, 0, 0);
            result   = LogFormatter.FormatLogTimeStamp(testTime);
            Assertion.AssertEquals("00:00:00.000", result);
        }