コード例 #1
0
ファイル: WeekendPolicyTests.cs プロジェクト: aelhadi/opencbs
 public void IsNonWorkingDay_GivenFridayAndSundayAsWeekends_WhenPassSaturdayReturnsFalse()
 {
     var policy = new WeekendPolicy();
     policy.AddWeekend(DayOfWeek.Friday);
     policy.AddWeekend(DayOfWeek.Sunday);
     var date = new DateTime(2013, 6, 8);
     Assert.That(policy.IsNonWorkingDay(date), Is.EqualTo(false));
 }
コード例 #2
0
 public void SetUp()
 {
     _weekendPolicy = new WeekendPolicy();
     _weekendPolicy.AddWeekend(DayOfWeek.Saturday);
     _weekendPolicy.AddWeekend(DayOfWeek.Sunday);
     _holidayPolicy = new HolidayPolicy();
     _holidayPolicy.AddHoliday(new DateTime(2013, 1, 1));
     _policy = new NonWorkingDayPolicy(_weekendPolicy, _holidayPolicy);
 }
コード例 #3
0
 public void ShiftDate_GivenSaturdayAndSundayAsWeekendsAndPassSunday_ReturnsPreviousFirday()
 {
     var weekendPolicy = new WeekendPolicy();
     weekendPolicy.AddWeekend(DayOfWeek.Saturday);
     weekendPolicy.AddWeekend(DayOfWeek.Sunday);
     var dateShiftPolicy = new BackwardDateShiftPolicy(weekendPolicy);
     var sunday = new DateTime(2013, 6, 9);
     var friday = new DateTime(2013, 6, 7);
     Assert.That(dateShiftPolicy.ShiftDate(sunday), Is.EqualTo(friday));
 }
コード例 #4
0
 public void ShiftDate_GivenSaturdayAndSundayAsWeekendsAndPassSaturday_ReturnsNextMonday()
 {
     var weekendPolicy = new WeekendPolicy();
     weekendPolicy.AddWeekend(DayOfWeek.Saturday);
     weekendPolicy.AddWeekend(DayOfWeek.Sunday);
     var dateShiftPolicy = new ForwardDateShiftPolicy(weekendPolicy);
     var saturday = new DateTime(2013, 6, 8);
     var nextMonday = new DateTime(2013, 6, 10);
     Assert.That(dateShiftPolicy.ShiftDate(saturday), Is.EqualTo(nextMonday));
 }
コード例 #5
0
ファイル: WeekendPolicyTests.cs プロジェクト: aelhadi/opencbs
        public void IsNonWorkingDay_GivenSaturdayAndSundayAsWeekends_WhenPassMondayToFridayReturnsFalse()
        {
            var policy = new WeekendPolicy();
            policy.AddWeekend(DayOfWeek.Saturday);
            policy.AddWeekend(DayOfWeek.Sunday);

            // 3rd to 7th June 2013 are working days
            for (var day = 3; day <= 7; day++)
            {
                var date = new DateTime(2013, 6, day);
                Assert.That(policy.IsNonWorkingDay(date), Is.EqualTo(false));
            }
        }