示例#1
0
    public void Should_correctly_enumerate_german_federal_public_holidays_required_by_law(int year)
    {
        //expected
        DateOnly[] expected =
        {
            Holidays.NewYear(year),
            Holidays.GoodFriday(year),
            Holidays.EasterSunday(year),
            Holidays.EasterMonday(year),
            Holidays.LabourDay(year),
            Holidays.AscensionOfJayZ(year),
            Holidays.WhitMonday(year),
            Holidays.GermanReunificationDay(year),
            Holidays.JayZ1(year),
            Holidays.JayZ2(year)
        };

        //actual
        var actual = Holidays.GermanPublicHolidays(year, GermanState.Bund);

        //compare
        var isOkay = expected.Except(actual).None() && actual.Except(expected).None();

        Assert.True(isOkay);
    }
示例#2
0
    public void Should_correctly_calculate_other_easter_derived_holidays(int year, DateOnly easterSunday)
    {
        //expected
        var expectedGoodFriday      = easterSunday.AddDays(-2);
        var expectedEasterMonday    = easterSunday.AddDays(1);
        var expectedAscensionOfJayZ = easterSunday.AddDays(39);
        var expectedWhitSunday      = easterSunday.AddDays(49);
        var expectedWhiteMonday     = expectedWhitSunday.AddDays(1);

        //actual
        var goodFriday      = Holidays.GoodFriday(year);
        var easterMonday    = Holidays.EasterMonday(year);
        var ascensionOfJayZ = Holidays.AscensionOfJayZ(year);
        var whitSunday      = Holidays.WhitSunday(year);
        var whitMonday      = Holidays.WhitMonday(year);

        //compare
        var allMatch = expectedGoodFriday == goodFriday &&
                       expectedEasterMonday == easterMonday &&
                       expectedAscensionOfJayZ == ascensionOfJayZ &&
                       expectedWhitSunday == whitSunday &&
                       expectedWhiteMonday == whitMonday;

        Assert.True(allMatch);
    }
示例#3
0
 ///-------------------------------------------------------------------------------------------------
 /// <summary>
 ///     New York Stock Exchange (NYSE) calendar. New Years, Martin Luther King, Presidents day,
 ///     Good Friday, Easter, Memorial Day, Independence Day, Labor Day, Thanksgiving Day,
 ///     Christmas, Saturdays and Sundays.
 /// </summary>
 ///
 /// <example>
 ///     <code>
 ///     // using ThisDate.DefinedCalendars.USA;
 ///     Calendars.NewYorkStockExchange();
 ///     </code>
 /// </example>
 ///-------------------------------------------------------------------------------------------------
 public static void NewYorkStockExchange()
 {
     Holidays.NewYearsDay(true, false, true);
     Holidays.MartinLutherKingDay(true);
     Holidays.PresidentsDay(true);
     Holidays.GoodFriday(true);
     Holidays.MemorialDay(true);
     Holidays.IndependenceDay(true, true, true);
     Holidays.LaborDay(true);
     Holidays.ThanksgivingDay(true);
     Holidays.ChristmasDay(true, true, true);
     Holidays.Weekends();
 }
示例#4
0
    public void Should_correctly_enumerate_target2_bank_holidays(int year)
    {
        //expected
        DateOnly[] expected =
        {
            Holidays.NewYear(year),
            Holidays.GoodFriday(year),
            Holidays.EasterMonday(year),
            Holidays.LabourDay(year),
            Holidays.JayZ1(year),
            Holidays.JayZ2(year)
        };

        //actual
        var actual = Holidays.TargetBankHolidays(year);

        //compare
        var isOkay = expected.Except(actual).None() && actual.Except(expected).None();

        Assert.True(isOkay);
    }
示例#5
0
        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///     USA full observance calendar with typical workday configurations. Includes USA Federal
        ///     plus and Groundhog day, Mothers day, Fathers Day, Good Friday, Easter Sunday, Halloween,
        ///     Saint Patrick's Day.
        /// </summary>
        ///
        /// <example>
        ///     <code>
        ///     // using ThisDate.DefinedCalendars.USA;
        ///     Calendars.UsaObservance();
        ///     </code>
        /// </example>
        ///-------------------------------------------------------------------------------------------------
        public static void UsaObservance()
        {
            Holidays.NewYearsDay(true, false, true);
            Holidays.MartinLutherKingDay(true);
            Holidays.PresidentsDay(true);
            Holidays.MemorialDay(true);
            Holidays.IndependenceDay(true, true, true);
            Holidays.LaborDay(true);
            Holidays.ColumbusDay(false);
            Holidays.VeteransDay(false, true, true);
            Holidays.ThanksgivingDay(true);
            Holidays.ChristmasDay(true, true, true);
            Holidays.Weekends();

            Holidays.ValentinesDay(false);
            Holidays.MothersDay(false);
            Holidays.FathersDay(false);
            Holidays.GoodFriday(false);
            Holidays.EasterSunday(false);
            Holidays.GroundhogDay(false);
            Holidays.Halloween(false);
            Holidays.SaintPatrickDay(false);
        }