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); }
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); }