public void GetDateTimeFromDateTest() { Date date = new Date( 2009, 7, 22 ); TimeSpan timeSpan = new TimeSpan( 0, 18, 23, 56, 344 ); Time time = new Time( timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds, timeSpan.Milliseconds ); Assert.AreEqual( time.GetDateTime( date ), date.GetDateTime().Add( timeSpan ) ); }
// ---------------------------------------------------------------------- public DateTime GetDateTime( Date date ) { return date.GetDateTime( this ); }
public void GetDateTimeTest1() { DateTime dateTime1 = new DateTime( 2009, 7, 22 ); Date date1 = new Date( dateTime1 ); Assert.AreEqual( date1.GetDateTime(), dateTime1.Date ); DateTime dateTime2 = new DateTime( 2009, 7, 22, 18, 23, 56, 344 ); Date date2 = new Date( dateTime2 ); Assert.AreEqual( date2.GetDateTime(), dateTime2.Date ); }
public void GetDateTimeTest2() { DateTime dateTime = new DateTime( 2009, 7, 22 ); Date date = new Date( dateTime ); Assert.AreEqual( date.GetDateTime(), dateTime ); Assert.AreEqual( date.GetDateTime( 1 ), new DateTime( dateTime.Year, dateTime.Month, dateTime.Day, 1, 0, 0, 0 ) ); Assert.AreEqual( date.GetDateTime( 1, 1 ), new DateTime( dateTime.Year, dateTime.Month, dateTime.Day, 1, 1, 0, 0 ) ); Assert.AreEqual( date.GetDateTime( 1, 1, 1 ), new DateTime( dateTime.Year, dateTime.Month, dateTime.Day, 1, 1, 1, 0 ) ); Assert.AreEqual( date.GetDateTime( 1, 1, 1, 1 ), new DateTime( dateTime.Year, dateTime.Month, dateTime.Day, 1, 1, 1, 1 ) ); }
} // GetDateTime // ---------------------------------------------------------------------- public DateTime GetDateTime(Date date) { return(date.GetDateTime(this)); } // GetDateTime
/// <summary> /// /// </summary> /// <param name="from"></param> public SerializableDate(Date from) { _data = from.GetDateTime(); }