public void ConvertFromStringTest() { FormatterDate target = new FormatterDate(); string s = "02/01/2007"; DateTime expected = new DateTime(0); expected = expected.AddYears(2007 - 1); expected = expected.AddMonths(1 - 1); expected = expected.AddDays(02 - 1); DateTime?actual; actual = ((IFormatter <DateTime?>)target).ConvertFromString(s); Assert.AreEqual(expected, actual.Value); }
public void ConvertToStringTest() { FormatterDate target = new FormatterDate(); target.FormatString = "dd/MM/yyyy"; DateTime val = new DateTime(0); val = val.AddYears(2007 - 1); val = val.AddMonths(1 - 1); val = val.AddDays(13 - 1); string expected = "13/01/2007"; string actual; actual = target.ConvertToString(val); Assert.AreEqual(expected, actual); }
public void ConvertFromStringBadFormatTest() { FormatterDate target = new FormatterDate(); target.ConvertFromString("azerty"); }
public void ConvertFromStringEmptyTest() { FormatterDate target = new FormatterDate(); Assert.IsNull(target.ConvertFromString(String.Empty)); }
public void ConvertFromStringNullTest() { FormatterDate target = new FormatterDate(); Assert.IsNull(target.ConvertFromString(null)); }
public void FormatterUnit() { FormatterDate formatter = new FormatterDate(); Assert.IsNull(formatter.Unit); }
public void FormatterDateConstructorTest() { FormatterDate target = new FormatterDate(); }