public void Test_Construct() { //---------------Set up test pack------------------- //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- DateTimeTodayConverter dateTimeTodayConverter = new DateTimeTodayConverter(); //---------------Test Result ----------------------- Assert.IsInstanceOf(typeof(TypeConverter), dateTimeTodayConverter); }
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); }
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); }
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); }