Esempio n. 1
0
 public void TimeDifference_TimeDiff_HourBoundaryOneMinute()
 {
     TimeDiff.TimeOfDay    early    = new TimeDiff.TimeOfDay(1, 59, true);
     TimeDiff.TimeOfDay    late     = new TimeDiff.TimeOfDay(2, 0, true);
     TimeDiff.TimeInterval expected = new TimeDiff.TimeInterval(0, 1);
     TimeDiff.TimeInterval actual   = TimeDiff.computeTimeDiff(early, late);
     Assert.AreEqual(expected.hours, actual.hours, "Hours are incorrect");
     Assert.AreEqual(expected.minutes, actual.minutes, "Minutes are incorrect");
 }
Esempio n. 2
0
 public void TimeDifference_TimeDiff_MorningBoundaryAfternoonToMorning()
 {
     TimeDiff.TimeOfDay    early    = new TimeDiff.TimeOfDay(12, 0, true);
     TimeDiff.TimeOfDay    late     = new TimeDiff.TimeOfDay(11, 59, false);
     TimeDiff.TimeInterval expected = new TimeDiff.TimeInterval(23, 59);
     TimeDiff.TimeInterval actual   = TimeDiff.computeTimeDiff(early, late);
     Assert.AreEqual(expected.hours, actual.hours, "Hours are incorrect");
     Assert.AreEqual(expected.minutes, actual.minutes, "Minutes are incorrect");
 }
Esempio n. 3
0
 public void TimeDifference_TimeDiff_InvalidNegativeLateMinuteAM()
 {
     TimeDiff.TimeOfDay    early    = new TimeDiff.TimeOfDay(12, 0, false);
     TimeDiff.TimeOfDay    late     = new TimeDiff.TimeOfDay(12, -1, false);
     TimeDiff.TimeInterval expected = new TimeDiff.TimeInterval(ERROR_INTERVAL, ERROR_INTERVAL);
     TimeDiff.TimeInterval actual   = TimeDiff.computeTimeDiff(early, late);
     Assert.AreEqual(expected.hours, actual.hours, "Hours don't have validation");
     Assert.AreEqual(expected.minutes, actual.minutes, "Minutes don't have validation");
 }
Esempio n. 4
0
 public void TimeDifference_TimeDiff_12HourDifference()
 {
     TimeDiff.TimeOfDay    early    = new TimeDiff.TimeOfDay(2, 0, false);
     TimeDiff.TimeOfDay    late     = new TimeDiff.TimeOfDay(2, 0, true);
     TimeDiff.TimeInterval expected = new TimeDiff.TimeInterval(12, 0);
     TimeDiff.TimeInterval actual   = TimeDiff.computeTimeDiff(early, late);
     Assert.AreEqual(expected.hours, actual.hours, "Hours are incorrect");
     Assert.AreEqual(expected.minutes, actual.minutes, "Minutes are incorrect");
 }
Esempio n. 5
0
 public void TimeDifference_TimeDiff_MorningAndEvening()
 {
     TimeDiff.TimeOfDay    early    = new TimeDiff.TimeOfDay(3, 45, false);
     TimeDiff.TimeOfDay    late     = new TimeDiff.TimeOfDay(6, 10, true);
     TimeDiff.TimeInterval expected = new TimeDiff.TimeInterval(14, 25);
     TimeDiff.TimeInterval actual   = TimeDiff.computeTimeDiff(early, late);
     Assert.AreEqual(expected.hours, actual.hours, "Hours are incorrect");
     Assert.AreEqual(expected.minutes, actual.minutes, "Minutes are incorrect");
 }