public void Can_convert_Gregorian_date_to_Jewish_Jewish_Month() { DateTime dateTime; //Leap year dateTime = new DateTime(2016, 4, 8, gregorianCalendar); Assert.That(jewishCalendar.GetJewishMonth(dateTime), Is.EqualTo(JewishCalendar.JewishMonth.ADAR_II)); dateTime = new DateTime(2016, 4, 9, gregorianCalendar); Assert.That(jewishCalendar.GetJewishMonth(dateTime), Is.EqualTo(JewishCalendar.JewishMonth.NISSAN)); dateTime = new DateTime(2015, 9, 14, gregorianCalendar); Assert.That(jewishCalendar.GetJewishMonth(dateTime), Is.EqualTo(JewishCalendar.JewishMonth.TISHREI)); dateTime = new DateTime(2016, 6, 12, gregorianCalendar); Assert.That(jewishCalendar.GetJewishMonth(dateTime), Is.EqualTo(JewishCalendar.JewishMonth.SIVAN)); //Regular year dateTime = new DateTime(2015, 3, 20, gregorianCalendar); Assert.That(jewishCalendar.GetJewishMonth(dateTime), Is.EqualTo(JewishCalendar.JewishMonth.ADAR)); dateTime = new DateTime(2015, 3, 21, gregorianCalendar); Assert.That(jewishCalendar.GetJewishMonth(dateTime), Is.EqualTo(JewishCalendar.JewishMonth.NISSAN)); }
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); }