Ejemplo n.º 1
0
        public void ProvincialTotalsTest()
        {
            var result = new CanadaPublicHoliday("AB").PublicHolidayNames(2013);

            Assert.AreEqual(12, result.Count);

            result = new CanadaPublicHoliday("BC").PublicHolidayNames(2013);
            Assert.AreEqual(10, result.Count);

            result = new CanadaPublicHoliday("MB").PublicHolidayNames(2013);
            Assert.AreEqual(9, result.Count);

            result = new CanadaPublicHoliday("NB").PublicHolidayNames(2013);
            Assert.AreEqual(10, result.Count);

            result = new CanadaPublicHoliday("NL").PublicHolidayNames(2013);
            Assert.AreEqual(12, result.Count);

            result = new CanadaPublicHoliday("NT").PublicHolidayNames(2013);
            Assert.AreEqual(10, result.Count);

            result = new CanadaPublicHoliday("NS").PublicHolidayNames(2013);
            Assert.AreEqual(11, result.Count);

            result = new CanadaPublicHoliday("NU").PublicHolidayNames(2013);
            Assert.AreEqual(9, result.Count);

            result = new CanadaPublicHoliday("ON").PublicHolidayNames(2013);
            Assert.AreEqual(9, result.Count);

            result = new CanadaPublicHoliday("PE").PublicHolidayNames(2013);
            Assert.AreEqual(12, result.Count);

            result = new CanadaPublicHoliday("QC").PublicHolidayNames(2013);
            Assert.AreEqual(8, result.Count);

            result = new CanadaPublicHoliday("SK").PublicHolidayNames(2013);
            Assert.AreEqual(10, result.Count);

            result = new CanadaPublicHoliday("YT").PublicHolidayNames(2013);
            Assert.AreEqual(11, result.Count);
        }
        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);
        }