public void ShiftDate_GivenFirstOfJanuaryAsHolidayAndPassThisDate_ReturnsThirtyFirstOfDecember()
 {
     var holidayPolicy = new HolidayPolicy();
     var firstOfJanuary = new DateTime(2013, 1, 1);
     holidayPolicy.AddHoliday(firstOfJanuary);
     var dateShiftPolicy = new BackwardDateShiftPolicy(holidayPolicy);
     var thirtyFirstOfDecember = new DateTime(2012, 12, 31);
     Assert.That(dateShiftPolicy.ShiftDate(firstOfJanuary), Is.EqualTo(thirtyFirstOfDecember));
 }
 public void ShiftDate_GivenFirstOfJanuaryAsHolidayAndPassThisDate_ReturnsSecondOfJanuary()
 {
     var holidayPolicy = new HolidayPolicy();
     var firstOfJanuary = new DateTime(2013, 1, 1);
     holidayPolicy.AddHoliday(firstOfJanuary);
     var dateShiftPolicy = new ForwardDateShiftPolicy(holidayPolicy);
     var secondOfJanuary = new DateTime(2013, 1, 2);
     Assert.That(dateShiftPolicy.ShiftDate(firstOfJanuary), Is.EqualTo(secondOfJanuary));
 }
예제 #3
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);
 }
예제 #4
0
 public void IsNonWorkingDay_GivenAHolidayAndPassDifferentDate_ReturnsFalse()
 {
     var policy = new HolidayPolicy();
     policy.AddHoliday(new DateTime(2013, 5, 1));
     Assert.That(policy.IsNonWorkingDay(new DateTime(2013, 5, 2)), Is.EqualTo(false));
 }
예제 #5
0
 public void IsNonWorkingDay_GivenAHolidayAndPassSameDate_ReturnsTrue()
 {
     var policy = new HolidayPolicy();
     policy.AddHoliday(new DateTime(2013, 5, 1));
     Assert.That(policy.IsNonWorkingDay(new DateTime(2013, 5, 1)), Is.EqualTo(true));
 }