Ejemplo n.º 1
0
        ///<inheritdoc/>
        public IEnumerable <PublicHoliday> Get(int year)
        {
            var countryCode = CountryCode.FI;

            var midsummerEve = DateSystem.FindDay(year, Month.June, 19, DayOfWeek.Friday);
            var midsummerDay = DateSystem.FindDay(year, Month.June, 20, DayOfWeek.Saturday);
            var allSaintsDay = DateSystem.FindDayBetween(year, 10, 31, year, 11, 6, DayOfWeek.Saturday);

            var items = new List <PublicHoliday>();

            items.Add(new PublicHoliday(year, 1, 1, "Uudenvuodenpäivä", "New Year's Day", countryCode));
            items.Add(new PublicHoliday(year, 1, 6, "Loppiainen", "Epiphany", countryCode));
            items.Add(this._catholicProvider.GoodFriday("Pitkäperjantai", year, countryCode));
            items.Add(this._catholicProvider.EasterSunday("Pääsiäispäivä", year, countryCode));
            items.Add(this._catholicProvider.EasterMonday("2. pääsiäispäivä", year, countryCode));
            items.Add(new PublicHoliday(year, 5, 1, "Vappu", "May Day", countryCode));
            items.Add(this._catholicProvider.AscensionDay("Helatorstai", year, countryCode));
            items.Add(this._catholicProvider.Pentecost("Helluntaipäivä", year, countryCode));
            items.Add(new PublicHoliday(midsummerEve, "Juhannusaatto", "Midsummer Eve", countryCode));
            items.Add(new PublicHoliday(midsummerDay, "Juhannuspäivä", "Midsummer Day", countryCode));
            items.Add(new PublicHoliday(allSaintsDay, "Pyhäinpäivä", "All Saints' Day", countryCode));
            items.Add(new PublicHoliday(year, 12, 6, "Itsenäisyyspäivä", "Independence Day", countryCode));
            items.Add(new PublicHoliday(year, 12, 24, "Jouluaatto", "Christmas Eve", countryCode));
            items.Add(new PublicHoliday(year, 12, 25, "Joulupäivä", "Christmas Day", countryCode));
            items.Add(new PublicHoliday(year, 12, 26, "2. joulupäivä", "St. Stephen's Day", countryCode));

            return(items.OrderBy(o => o.Date));
        }
Ejemplo n.º 2
0
        public void CheckFindDayBetween()
        {
            var result = DateSystem.FindDayBetween(2019, 7, 1, 2019, 7, 7, DayOfWeek.Tuesday);

            Assert.AreEqual(new DateTime(2019, 7, 2), result);

            result = DateSystem.FindDayBetween(2019, 7, 1, 2019, 7, 7, DayOfWeek.Wednesday);
            Assert.AreEqual(new DateTime(2019, 7, 3), result);

            result = DateSystem.FindDayBetween(2019, 7, 1, 2019, 7, 7, DayOfWeek.Friday);
            Assert.AreEqual(new DateTime(2019, 7, 5), result);

            result = DateSystem.FindDayBetween(2019, 7, 1, 2019, 7, 7, DayOfWeek.Saturday);
            Assert.AreEqual(new DateTime(2019, 7, 6), result);
        }