public void AddHoursTest() { DateTime now = ClockProxy.Clock.Now; DateTime nowHour = new DateTime( now.Year, now.Month, now.Day, now.Hour, 0, 0 ); Hour hour = new Hour( now, TimeCalendar.New( TimeSpan.Zero, TimeSpan.Zero ) ); Assert.AreEqual( hour.AddHours( 0 ), hour ); DateTime previousHour = nowHour.AddHours( -1 ); Assert.AreEqual( hour.AddHours( -1 ).Year, previousHour.Year ); Assert.AreEqual( hour.AddHours( -1 ).Month, previousHour.Month ); Assert.AreEqual( hour.AddHours( -1 ).Day, previousHour.Day ); Assert.AreEqual( hour.AddHours( -1 ).HourValue, previousHour.Hour ); DateTime nextHour = nowHour.AddHours( 1 ); Assert.AreEqual( hour.AddHours( 1 ).Year, nextHour.Year ); Assert.AreEqual( hour.AddHours( 1 ).Month, nextHour.Month ); Assert.AreEqual( hour.AddHours( 1 ).Day, nextHour.Day ); Assert.AreEqual( hour.AddHours( 1 ).HourValue, nextHour.Hour ); }
public void GetPreviousHourTest() { Hour hour = new Hour(); Assert.AreEqual( hour.GetPreviousHour(), hour.AddHours( -1 ) ); }
public void GetNextHourTest() { Hour hour = new Hour(); Assert.AreEqual( hour.GetNextHour(), hour.AddHours( 1 ) ); }