Ejemplo n.º 1
0
        public void AddTimeUnits_ReturnsProperDate_NegativeUnitsWithMoreHolidays()
        {
            //Arrange
            DaysProcessor processor = getProcessorForAfterManyHolidaysInDifferentYears();
            DateTime      baseDate  = new DateTime(2017, 8, 29);

            //Act
            DateTime result = processor.AddTimeUnits(baseDate, 1, -1451);

            //Assert
            DateTime expectedDate = new DateTime(2012, 1, 25);

            Assert.AreEqual(expectedDate, result);
        }
Ejemplo n.º 2
0
        public void AddTimeUnits_ReturnsProperDate_NegativeUnitsWithWeekend()
        {
            //Arrange
            DaysProcessor processor = new DaysProcessor();
            DateTime      baseDate  = new DateTime(2016, 8, 17);

            //Act
            DateTime result = processor.AddTimeUnits(baseDate, 1, -9);

            //Assert
            DateTime expectedDate = new DateTime(2016, 8, 4);

            Assert.AreEqual(expectedDate, result);
        }
Ejemplo n.º 3
0
        public void AddTimeUnits_ReturnsProperDate_PositiveUnitsWithoutDayOff()
        {
            //Arrange
            DaysProcessor processor = new DaysProcessor();
            DateTime      baseDate  = new DateTime(2017, 4, 18);

            //Act
            DateTime result = processor.AddTimeUnits(baseDate, 1, 3);

            //Assert
            DateTime expectedDate = new DateTime(2017, 4, 21);

            Assert.AreEqual(expectedDate, result);
        }
Ejemplo n.º 4
0
        public void AddTimeUnits_ReturnsTheSameDate_IfUnitsZero()
        {
            //Arrange
            DaysProcessor processor = new DaysProcessor();
            DateTime      baseDate  = new DateTime(2017, 4, 21);

            //Act
            DateTime result = processor.AddTimeUnits(baseDate, 1, 0);

            //Assert
            DateTime expectedDate = new DateTime(2017, 4, 21);

            Assert.AreEqual(expectedDate, result);
        }
Ejemplo n.º 5
0
        public void AddTimeUnits_ReturnsProperDate_NegativeUnitsWithHolidayAndWeekend()
        {
            //Arrange
            DaysProcessor processor = getProcessorForAfterManyHolidaysInDifferentYears();

            processor.AddHoliday(new DateTime(2017, 5, 5));
            DateTime baseDate = new DateTime(2017, 5, 9);

            //Act
            DateTime result = processor.AddTimeUnits(baseDate, 1, -2);

            //Assert
            DateTime expectedDate = new DateTime(2017, 5, 4);

            Assert.AreEqual(expectedDate, result);
        }
Ejemplo n.º 6
0
        public void AddTimeUnits_ReturnsProperDate_WhenSubtractOneDayAndBaseDayIsTuesdayAfterHolidayMonday()
        {
            //Arrange
            DaysProcessor processor = getProcessorForAfterManyHolidaysInDifferentYears();

            processor.AddHoliday(new DateTime(2017, 5, 1));
            DateTime baseDate = new DateTime(2017, 5, 2);

            //Act
            DateTime result = processor.AddTimeUnits(baseDate, 1, -1);

            //Assert
            DateTime expectedDate = new DateTime(2017, 4, 28);

            Assert.AreEqual(expectedDate, result);
        }
Ejemplo n.º 7
0
        public void AddTimeUnits_ReturnsProperDate_NegativeUnitsWithHoliday()
        {
            //Arrange
            DaysProcessor processor = new DaysProcessor();

            processor.AddHoliday(new DateTime(2014, 1, 1));
            DateTime baseDate = new DateTime(2014, 1, 3);

            //Act
            DateTime result = processor.AddTimeUnits(baseDate, 1, -2);

            //Assert
            DateTime expectedDate = new DateTime(2013, 12, 31);

            Assert.AreEqual(expectedDate, result);
        }
Ejemplo n.º 8
0
        public void AddTimeUnits_ReturnsProperDate_WhenAddOneDayAndBaseDayIsThursdayBeforeHolidayFriday()
        {
            //Arrange
            DaysProcessor processor = getProcessorForAfterManyHolidaysInDifferentYears();

            processor.AddHoliday(new DateTime(2016, 1, 1));
            DateTime baseDate = new DateTime(2015, 12, 31);

            //Act
            DateTime result = processor.AddTimeUnits(baseDate, 1, 1);

            //Assert
            DateTime expectedDate = new DateTime(2016, 1, 4);

            Assert.AreEqual(expectedDate, result);
        }