public void DaysBetweenLocalDates_DifferentCalendarsThrows() { var start = new LocalDate(2020, 6, 13, CalendarSystem.Iso); var end = new LocalDate(2020, 6, 15, CalendarSystem.Julian); Assert.Throws <ArgumentException>(() => Period.DaysBetween(start, end)); }
public void DaysBetweenLocalDates_StartDateGreaterThanEndDate(string startText, string endText, int expected) { var start = LocalDatePattern.Iso.Parse(startText).Value; var end = LocalDatePattern.Iso.Parse(endText).Value; var actual = Period.DaysBetween(start, end); Assert.AreEqual(expected, actual); }
public void DaysBetweenLocalDates_SameDatesReturnsZero() { var start = new LocalDate(2020, 6, 13, CalendarSystem.Iso); var end = start; var expected = 0; var actual = Period.DaysBetween(start, end); Assert.AreEqual(expected, actual); }
public int UnitsBetween(LocalDate start, LocalDate end) => Period.DaysBetween(start, end) / unitDays;