Пример #1
0
        public void Test_Construct()
        {
            //---------------Set up test pack-------------------
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            DateTimeTodayConverter dateTimeTodayConverter = new DateTimeTodayConverter();

            //---------------Test Result -----------------------
            Assert.IsInstanceOf(typeof(TypeConverter), dateTimeTodayConverter);
        }
Пример #2
0
        public void Test_CanConvertTo_WithDateTime_ShouldReturnTrue()
        {
            //---------------Set up test pack-------------------
            DateTimeTodayConverter dateTimeTodayConverter = new DateTimeTodayConverter();
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            bool result = dateTimeTodayConverter.CanConvertTo(typeof(DateTime));

            //---------------Test Result -----------------------
            Assert.IsTrue(result);
        }
Пример #3
0
        public void Test_ConvertTo_WithDateTime_ShouldReturnTodayValue()
        {
            //---------------Set up test pack-------------------
            DateTimeTodayConverter dateTimeTodayConverter = new DateTimeTodayConverter();
            DateTimeToday          dateTimeToday          = new DateTimeToday();
            DateTime snapshot = DateTime.Today;
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            object result = dateTimeTodayConverter.ConvertTo(dateTimeToday, typeof(DateTime));
            //---------------Test Result -----------------------
            DateTime dateTime = TestUtil.AssertIsInstanceOf <DateTime>(result);

            Assert.AreEqual(snapshot, dateTime);
        }
Пример #4
0
        public void Test_ConvertTo_WhenDateTimeTodayWithOfSet_ShouldRetOffSetValue()
        {
            //---------------Set up test pack-------------------
            DateTimeTodayConverter dateTimeTodayConverter = new DateTimeTodayConverter();
            DateTimeToday          dateTimeToday          = new DateTimeToday {
                OffSet = -5
            };
            DateTime expectedResult = DateTime.Today.AddDays(dateTimeToday.OffSet);
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            object result = dateTimeTodayConverter.ConvertTo(dateTimeToday, typeof(DateTime));

            //---------------Test Result -----------------------
            Assert.AreEqual(expectedResult, result);
        }