Пример #1
0
        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));
        }
Пример #2
0
        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);
        }
Пример #3
0
        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;