public void DefaultFormatTest2() { DateTimeColumnFormat format = new DateTimeColumnFormat(); var result = format.Format(new DateTime(1900, 1, 1, 0, 0, 0, 0)); Assert.AreEqual("1900-01-01", result); }
public void DefaultFormatTest3() { DateTimeColumnFormat format = new DateTimeColumnFormat(); var result = format.Format(new DateTime(2000, 5, 1, 9, 30, 10, 0)); Assert.AreEqual("2000-05-01 09:30:10", result); }
public void FormatNullTest() { DateTimeColumnFormat format = new DateTimeColumnFormat(); var result = format.Format(DBNull.Value); Assert.AreEqual(ColumnFormat.NullText, result); }
public void TestAutoFormatWithDateOnlyValues() { List <object> values = new List <object>(); values.Add(new DateTime(1900, 1, 1)); values.Add(new DateTime(2099, 12, 31)); DateTimeColumnFormat format = new DateTimeColumnFormat(); format.AutoFormat(values, false); string formatString = format.FormatString; Assert.AreEqual("{0:yyyy-MM-dd}", formatString); }
public void TestAutoFormatWithDateTimeValues() { List <object> values = new List <object>(); values.Add(new DateTime(1900, 1, 1)); values.Add(new DateTime(2099, 12, 31)); values.Add(new DateTime(1900, 1, 1, 0, 0, 0, 500)); values.Add(new DateTime(2099, 12, 31, 23, 59, 59, 0)); DateTimeColumnFormat format = new DateTimeColumnFormat(); format.AutoFormat(values, false); string formatString = format.FormatString; Assert.AreEqual("{0:yyyy-MM-dd HH':'mm':'ss'.'fff}", formatString); }