public void can_get_strateryies() { var dateTimeCulture = new DateTimeCultureInfo("ar-SA"); var holidaysStrategy = dateTimeCulture.LocateHolidayStrategy(dateTimeCulture.Name); Assert.AreEqual(typeof(AR_SAHolidayStrategy), holidaysStrategy.GetType()); var workingDaysStrategy = dateTimeCulture.LocateWorkingDayOfWeekStrategy(dateTimeCulture.Name); Assert.AreEqual(typeof(AR_SAWorkingDayOfWeekStrategy), workingDaysStrategy.GetType()); }
public void assert_holidays_on_weekend_observed_on_monday() { var dateTimeCulture = new DateTimeCultureInfo("fr-CA"); // 01-07-2012 Canada Day on a Sunday var mondayAfterCanadaDay = new DateTime(2012, 07, 02); Assert.AreEqual(DayOfWeek.Monday, mondayAfterCanadaDay.DayOfWeek); Assert.IsFalse(mondayAfterCanadaDay.IsWorkingDay(dateTimeCulture)); }
public void Export(DateTimeCultureInfo dateTimeCultureInfo, int year, TextWriter writer) { var holidays = dateTimeCultureInfo.GetHolidaysOfYear(year); writer.WriteLine(HeaderLineFomat, dateTimeCultureInfo.Name, holidays.Count()); foreach (var holiday in holidays) { var instance = holiday.GetInstance(year); if (instance.HasValue) { writer.WriteLine(HolidayLineFormat, holiday.Name, instance); } } }
public void holiday_days_span() { var dateTimeCulture = new DateTimeCultureInfo("ar-SA"); var holiday = AR_SAHolidayStrategy.EndOfHajj; var startDay = holiday.GetInstance(2012); //Eid-al-Fitr DateTime day = new DateTime(2012, 8, 19); do { Assert.IsFalse(dateTimeCulture.IsWorkingDay(day), day.ToString() + " shouldn't be a working day"); day = day.AddDays(1); } while (day <= new DateTime(2012, 8, 25)); //Eid-al-Adha day = new DateTime(2012, 10, 26); do { Assert.IsFalse(dateTimeCulture.IsWorkingDay(day), day.ToString() + " shouldn't be a working day"); day = day.AddDays(1); } while (day <= new DateTime(2012, 10, 31)); }
public void are_working_days_on_thursday_and_friday() { var dateTimeCulture = new DateTimeCultureInfo("ar-SA"); Assert.IsFalse(dateTimeCulture.IsWorkingDay(DayOfWeek.Thursday)); Assert.IsFalse(dateTimeCulture.IsWorkingDay(DayOfWeek.Friday)); }
public void can_get_stratery() { var dateTimeCulture = new DateTimeCultureInfo("fr-CA"); var strategy = dateTimeCulture.LocateHolidayStrategy(dateTimeCulture.Name); Assert.AreEqual(typeof(FR_CAHolidayStrategy),strategy.GetType()); }
public void assert_holidays_count() { var dateTimeCulture = new DateTimeCultureInfo("fr-CA"); var holidays = dateTimeCulture.Holidays; Assert.AreEqual(10, holidays.Count()); }