Esempio n. 1
0
 public void Validation()
 {
     TestHelper.AssertValid(Duration.FromDays, (1 << 24) - 1);
     TestHelper.AssertOutOfRange(Duration.FromDays, 1 << 24);
     TestHelper.AssertValid(Duration.FromDays, -(1 << 24));
     TestHelper.AssertOutOfRange(Duration.FromDays, -(1 << 24) - 1);
 }
Esempio n. 2
0
        public void FromTicksSinceUnixEpoch_Range()
        {
            long smallestValid = Instant.MinValue.ToUnixTimeTicks();
            long largestValid  = Instant.MaxValue.ToUnixTimeTicks();

            TestHelper.AssertValid(Instant.FromUnixTimeTicks, smallestValid);
            TestHelper.AssertOutOfRange(Instant.FromUnixTimeTicks, smallestValid - 1);
            TestHelper.AssertValid(Instant.FromUnixTimeTicks, largestValid);
            TestHelper.AssertOutOfRange(Instant.FromUnixTimeTicks, largestValid + 1);
        }
Esempio n. 3
0
        public void FromUnixTimeSeconds_Range()
        {
            long smallestValid = Instant.MinValue.ToUnixTimeTicks() / NodaConstants.TicksPerSecond;
            long largestValid  = Instant.MaxValue.ToUnixTimeTicks() / NodaConstants.TicksPerSecond;

            TestHelper.AssertValid(Instant.FromUnixTimeSeconds, smallestValid);
            TestHelper.AssertOutOfRange(Instant.FromUnixTimeSeconds, smallestValid - 1);
            TestHelper.AssertValid(Instant.FromUnixTimeSeconds, largestValid);
            TestHelper.AssertOutOfRange(Instant.FromUnixTimeSeconds, largestValid + 1);
        }
Esempio n. 4
0
        public void FromSecondsSinceUnixEpoch_Range()
        {
            long smallestValid = Instant.MinValue.Ticks / NodaConstants.TicksPerSecond;
            long largestValid  = Instant.MaxValue.Ticks / NodaConstants.TicksPerSecond;

            TestHelper.AssertValid(Instant.FromSecondsSinceUnixEpoch, smallestValid);
            TestHelper.AssertOutOfRange(Instant.FromSecondsSinceUnixEpoch, smallestValid - 1);
            TestHelper.AssertValid(Instant.FromSecondsSinceUnixEpoch, largestValid);
            TestHelper.AssertOutOfRange(Instant.FromSecondsSinceUnixEpoch, largestValid + 1);
        }
 public void GetAbsoluteYear_InvalidBce(int year)
 {
     TestHelper.AssertOutOfRange(Iso.GetAbsoluteYear, year, Era.BeforeCommon);
 }
 public void IsLeapYear_Invalid(int year)
 {
     TestHelper.AssertOutOfRange(Iso.IsLeapYear, year);
 }
 public void GetDaysInMonth_Hebrew()
 {
     TestHelper.AssertValid(CalendarSystem.HebrewCivil.GetDaysInMonth, 5402, 13);      // Leap year
     TestHelper.AssertOutOfRange(CalendarSystem.HebrewCivil.GetDaysInMonth, 5401, 13); // Not a leap year
 }
 public void GetDaysInMonth_Invalid(int year, int month)
 {
     TestHelper.AssertOutOfRange(Iso.GetDaysInMonth, year, month);
 }
 public void GetMonthsInYear_Invalid(int year)
 {
     TestHelper.AssertOutOfRange(Iso.GetMonthsInYear, year);
 }