Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        public void ConvertFromStringBadFormatTest()
        {
            FormatterDate target = new FormatterDate();

            target.ConvertFromString("azerty");
        }
Esempio n. 4
0
        public void ConvertFromStringEmptyTest()
        {
            FormatterDate target = new FormatterDate();

            Assert.IsNull(target.ConvertFromString(String.Empty));
        }
Esempio n. 5
0
        public void ConvertFromStringNullTest()
        {
            FormatterDate target = new FormatterDate();

            Assert.IsNull(target.ConvertFromString(null));
        }
Esempio n. 6
0
        public void FormatterUnit()
        {
            FormatterDate formatter = new FormatterDate();

            Assert.IsNull(formatter.Unit);
        }
Esempio n. 7
0
 public void FormatterDateConstructorTest()
 {
     FormatterDate target = new FormatterDate();
 }