public void GetPreviousTimeOff_ReturnsPreviousWeekendStart_IfThereIsNoPreviousHoliday() { //Arrange HolidaysManager manager = new HolidaysManager(); DateTime baseDate = new DateTime(2017, 5, 9); //Act DateTime date = manager.GetPreviousTimeOff(baseDate); //Assert DateTime expectedDate = new DateTime(2017, 5, 6, 0, 0, 0); Assert.AreEqual(expectedDate, date); }
public void GetPreviousTimeOff_ReturnsClosestRegisteredHoliday_IfItIsLaterThanPreviousWeekend() { //Arrange HolidaysManager manager = new HolidaysManager(); manager.AddHoliday(new DateTime(2017, 5, 1)); manager.AddHoliday(new DateTime(2017, 5, 3)); manager.AddHoliday(new DateTime(2017, 11, 11)); DateTime baseDate = new DateTime(2017, 5, 4, 16, 0, 0); //Act DateTime date = manager.GetPreviousTimeOff(baseDate); //Assert DateTime expectedDate = new DateTime(2017, 5, 2, 21, 0, 0); Assert.AreEqual(expectedDate, date); }