public void TestNewSouthWales2017(int month, int day, string name) { var holiday = new DateTime(2017, month, day); var holidayCalendar = new AustraliaPublicHoliday { State = AustraliaPublicHoliday.States.NSW }; var actual = holidayCalendar.IsPublicHoliday(holiday); Assert.IsTrue(actual, $"{holiday.ToString("D")} is not a holiday - should be {name}"); }
public void TestHolidays2017Lists() { var holidayCalendar = new AustraliaPublicHoliday(); //ALL states - just 7 national var hols = holidayCalendar.PublicHolidays(2017); var holNames = holidayCalendar.PublicHolidayNames(2017); //New Year's Day, Australia Day, Good Friday, Easter Monday, Anzac Day, Christmas Day and Boxing Day Assert.IsTrue(7 == hols.Count, "Should be 7 holidays in 2017"); Assert.IsTrue(holNames.Count == hols.Count, "Names and holiday list are same"); }
public void TestAustralianCapitalTerritory2017Lists() { var holidayCalendar = new AustraliaPublicHoliday { State = AustraliaPublicHoliday.States.ACT }; var hols = holidayCalendar.PublicHolidays(2017); var holNames = holidayCalendar.PublicHolidayNames(2017); Assert.IsTrue(11 == hols.Count, "Should be 11 holidays in 2017"); Assert.IsTrue(holNames.Count == hols.Count, "Names and holiday list are same"); }
public void TestAustralianNSW2016Lists() { var holidayCalendar = new AustraliaPublicHoliday { State = AustraliaPublicHoliday.States.NSW }; var hols = holidayCalendar.PublicHolidays(2016); var holNames = holidayCalendar.PublicHolidayNames(2016); Assert.IsTrue(9 == hols.Count, "Should be 9 holidays in 2016"); Assert.IsTrue(holNames.Count == hols.Count, "Names and holiday list are same"); }
public void TestQueensland2017(int month, int day, string name) { //https://www.qld.gov.au/recreation/travel/holidays/public/ var holiday = new DateTime(2017, month, day); var holidayCalendar = new AustraliaPublicHoliday { State = AustraliaPublicHoliday.States.QLD }; var actual = holidayCalendar.IsPublicHoliday(holiday); Assert.IsTrue(actual, $"{holiday.ToString("D")} is not a holiday - should be {name}"); }
public List <CountryPublicHolidayModel> GetPublicHolidayHandlers() { var publicHolidayHandlers = new List <CountryPublicHolidayModel>() { new CountryPublicHolidayModel() { CountryPublicHoliday = new AustriaPublicHoliday(), CountryCode = "AT/AUT", State = "" }, new CountryPublicHolidayModel() { CountryPublicHoliday = new BelgiumPublicHoliday(), CountryCode = "BE/BEL", State = "" }, new CountryPublicHolidayModel() { CountryPublicHoliday = new CzechRepublicPublicHoliday(), CountryCode = "CZ/CZE", State = "" }, new CountryPublicHolidayModel() { CountryPublicHoliday = new DutchPublicHoliday(), CountryCode = "NL/NLD", State = "" }, new CountryPublicHolidayModel() { CountryPublicHoliday = new EcbTargetClosingDay(), CountryCode = "", State = "" }, new CountryPublicHolidayModel() { CountryPublicHoliday = new FrancePublicHoliday(), CountryCode = "FR/FRA", State = "" }, new CountryPublicHolidayModel() { CountryPublicHoliday = new IrelandPublicHoliday(), CountryCode = "IE/IRL", State = "" }, new CountryPublicHolidayModel() { CountryPublicHoliday = new ItalyPublicHoliday(), CountryCode = "IT/ITA", State = "" }, new CountryPublicHolidayModel() { CountryPublicHoliday = new JapanPublicHoliday(), CountryCode = "JP/JPN", State = "" }, new CountryPublicHolidayModel() { CountryPublicHoliday = new KazakhstanPublicHoliday(), CountryCode = "KZ/KAZ", State = "" }, new CountryPublicHolidayModel() { CountryPublicHoliday = new NewZealandPublicHoliday(), CountryCode = "NZ/NZL", State = "" }, new CountryPublicHolidayModel() { CountryPublicHoliday = new NorwayPublicHoliday(), CountryCode = "NO/NOR", State = "" }, new CountryPublicHolidayModel() { CountryPublicHoliday = new PolandPublicHoliday(), CountryCode = "PL/POL", State = "" }, new CountryPublicHolidayModel() { CountryPublicHoliday = new SlovakiaPublicHoliday(), CountryCode = "SK/SVK", State = "" }, new CountryPublicHolidayModel() { CountryPublicHoliday = new SpainPublicHoliday(), CountryCode = "ES/ESP", State = "" }, new CountryPublicHolidayModel() { CountryPublicHoliday = new SwedenPublicHoliday(), CountryCode = "SE/SWE", State = "" }, new CountryPublicHolidayModel() { CountryPublicHoliday = new UKBankHoliday(), CountryCode = "GB/GBR", State = "" }, new CountryPublicHolidayModel() { CountryPublicHoliday = new USAPublicHoliday(), CountryCode = "US/USA", State = "" }, }; // Germany foreach (GermanPublicHoliday.States state in (GermanPublicHoliday.States[])Enum.GetValues(typeof(GermanPublicHoliday.States))) { if (state != GermanPublicHoliday.States.ALL) { var handler = new GermanPublicHoliday(); handler.State = state; var model = new CountryPublicHolidayModel() { CountryPublicHoliday = handler, CountryCode = "DE/DEU", State = state.ToString() }; publicHolidayHandlers.Add(model); } } // Australia foreach (AustraliaPublicHoliday.States state in (AustraliaPublicHoliday.States[])Enum.GetValues(typeof(AustraliaPublicHoliday.States))) { var handler = new AustraliaPublicHoliday(); handler.State = state; var model = new CountryPublicHolidayModel() { CountryPublicHoliday = handler, CountryCode = "AU/AUS", State = state.ToString() }; publicHolidayHandlers.Add(model); } // Canada foreach (var province in canadaProvinces) { var handler = new CanadaPublicHoliday(province); var model = new CountryPublicHolidayModel() { CountryPublicHoliday = handler, CountryCode = "CA/CAN", State = province }; publicHolidayHandlers.Add(model); } publicHolidayHandlers.Add(new CountryPublicHolidayModel() { CountryPublicHoliday = new SwitzerlandPublicHoliday(hasSecondJanuary: true, hasLaborDay: true, hasCorpusChristi: true, hasChristmasEve: true, hasNewYearsEve: true), CountryCode = "CH/CHE", State = "" }); return(publicHolidayHandlers); }