public void RebJohnnyTest() { DateTime dt; JewishCalendar.JewishHoliday holiday; //sanity check that assur b'melacha can pass dt = jewishCalendar.GetJewishDateTime(5777, JewishCalendar.JewishMonth.TISHREI, 1); Assert.That(jewishCalendar.IsYomTovAssurBemelacha(dt, true), Is.True); //purim shouldn't be assur b'melacha dt = jewishCalendar.GetJewishDateTime(5777, JewishCalendar.JewishMonth.ADAR, 14); holiday = jewishCalendar.GetJewishHoliday(dt, true); Assert.That(holiday, Is.EqualTo(JewishCalendar.JewishHoliday.PURIM)); Assert.That(jewishCalendar.IsYomTovAssurBemelacha(dt, true), Is.False); //shushan purim only in Israel dt = jewishCalendar.GetJewishDateTime(5777, JewishCalendar.JewishMonth.ADAR, 15); holiday = jewishCalendar.GetJewishHoliday(dt, true); Assert.AreEqual(holiday, JewishCalendar.JewishHoliday.SHUSHAN_PURIM); holiday = jewishCalendar.GetJewishHoliday(dt, false); Assert.AreNotEqual(holiday, JewishCalendar.JewishHoliday.SHUSHAN_PURIM); //taanit esther check dt = jewishCalendar.GetJewishDateTime(5777, JewishCalendar.JewishMonth.ADAR, 11); holiday = jewishCalendar.GetJewishHoliday(dt, true); Assert.AreEqual(holiday, JewishCalendar.JewishHoliday.FAST_OF_ESTHER); //pesach check dt = jewishCalendar.GetJewishDateTime(5777, JewishCalendar.JewishMonth.NISSAN, 15); holiday = jewishCalendar.GetJewishHoliday(dt, true); Assert.That(holiday, Is.EqualTo(JewishCalendar.JewishHoliday.PESACH)); Assert.That(jewishCalendar.IsYomTovAssurBemelacha(dt, true), Is.True); dt = jewishCalendar.GetJewishDateTime(5777, JewishCalendar.JewishMonth.NISSAN, 17); holiday = jewishCalendar.GetJewishHoliday(dt, true); Assert.That(holiday, Is.EqualTo(JewishCalendar.JewishHoliday.CHOL_HAMOED_PESACH)); Assert.That(jewishCalendar.IsYomTovAssurBemelacha(dt, true), Is.False); //yom hashoa check //Console.WriteLine ("DAY OF MONTH: " + dayOfMonth.ToString ()); //Console.WriteLine ("DAY OF Week: " + dayOfWeek.ToString ()); dt = jewishCalendar.GetJewishDateTime(5777, JewishCalendar.JewishMonth.NISSAN, 28); holiday = jewishCalendar.GetJewishHoliday(dt, true); Assert.That(holiday, Is.EqualTo(JewishCalendar.JewishHoliday.YOM_HASHOAH)); //pesach sheini dt = jewishCalendar.GetJewishDateTime(5777, JewishCalendar.JewishMonth.IYAR, 14); holiday = jewishCalendar.GetJewishHoliday(dt, true); Assert.That(holiday, Is.EqualTo(JewishCalendar.JewishHoliday.PESACH_SHENI)); Assert.That(jewishCalendar.IsYomTovAssurBemelacha(dt, true), Is.False); //tu b'av dt = jewishCalendar.GetJewishDateTime(5777, JewishCalendar.JewishMonth.AV, 15); holiday = jewishCalendar.GetJewishHoliday(dt, true); Assert.That(holiday, Is.EqualTo(JewishCalendar.JewishHoliday.TU_BEAV)); Assert.That(jewishCalendar.IsYomTovAssurBemelacha(dt, true), Is.False); }
public CalendarTimesViewModel getViewModel() { JewishCalendar cal = new JewishCalendar(); //create the view model CalendarTimesViewModel vm = new CalendarTimesViewModel(); DateTime date = calModel.date.GetValueOrDefault(); vm.DafYomiBavli = cal.GetDafYomiBavli(date); vm.DayOfChanukah = cal.GetDayOfChanukah(date); vm.DayOfOmer = cal.GetDayOfOmer(date); vm.isChanukah = cal.IsChanukah(date); vm.isCholHamoed = cal.IsCholHamoed(date, calModel.isIsrael); vm.isErevRoshChodesh = cal.IsErevRoshChodesh(date); vm.isErevYomTov = cal.IsErevYomTov(date, calModel.isIsrael); vm.isRoshChodesh = cal.IsRoshChodesh(date); vm.isTaanis = cal.IsTaanis(date, calModel.isIsrael); vm.isYomTov = cal.IsYomTov(date, calModel.isIsrael); vm.isYomTovIssurMelacha = cal.IsYomTovAssurBemelacha(date, calModel.isIsrael); vm.JewishHoliday = cal.GetJewishHoliday(date, calModel.isIsrael); vm.JewishMonth = cal.GetJewishMonth(date); vm.JewishYearType = cal.GetJewishYearType(date); return(vm); }