Esempio n. 1
0
        public void GetDaysSinceEpoch()
        {
            var calculator = new HebrewYearMonthDayCalculator(HebrewMonthNumbering.Scriptural);
            var unixEpoch  = new YearMonthDay(5730, 10, 23);

            Assert.AreEqual(0, calculator.GetDaysSinceEpoch(unixEpoch));
        }
Esempio n. 2
0
        public void DaysAtStartOfYear()
        {
            // These are somewhat random values used when diagnosing an issue.
            var calculator = new HebrewYearMonthDayCalculator(HebrewMonthNumbering.Scriptural);

            Assert.AreEqual(-110, calculator.GetStartOfYearInDays(5730));
            Assert.AreEqual(273, calculator.GetStartOfYearInDays(5731));
            Assert.AreEqual(-140735, calculator.GetStartOfYearInDays(5345));
            Assert.AreEqual(new YearMonthDay(5345, 1, 1), calculator.GetYearMonthDay(-140529));
        }
Esempio n. 3
0
        public void GetDaysInYearCrossCheck()
        {
            var calculator = new HebrewYearMonthDayCalculator(HebrewMonthNumbering.Civil);

            for (int year = calculator.MinYear; year <= calculator.MaxYear; year++)
            {
                int sum = Enumerable.Range(1, calculator.GetMonthsInYear(year))
                          .Sum(month => calculator.GetDaysInMonth(year, month));
                Assert.AreEqual(sum, calculator.GetDaysInYear(year), "Days in {0}", year);
            }
        }
Esempio n. 4
0
        public void DayOfYearAndReverse(HebrewMonthNumbering numbering)
        {
            var calculator = new HebrewYearMonthDayCalculator(numbering);

            for (int year = 5400; year < 5419; year++)
            {
                int daysInYear = calculator.GetDaysInYear(year);
                for (int dayOfYear = 1; dayOfYear <= daysInYear; dayOfYear++)
                {
                    YearMonthDay ymd = calculator.GetYearMonthDay(year, dayOfYear);
                    Assert.AreEqual(dayOfYear, calculator.GetDayOfYear(ymd));
                }
            }
        }