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)); }
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); }
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)); }
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)); }
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)); } }