示例#1
0
        public void OnGetTaskFinishingDate_With8WorkingDays()
        {
            TaskPlanner taskPlanner = new TaskPlanner();

            taskPlanner.SetWorkdayStartAndStop(new TimeSpan(8, 0, 0), new TimeSpan(16, 0, 0));
            taskPlanner.SetRecurringHoliday(new DateTime(2004, 5, 17, 0, 0, 0));
            taskPlanner.SetHoliday(new DateTime(2004, 5, 27, 0, 0, 0));

            var    start        = new DateTime(2004, 5, 24, 7, 3, 0);
            double numberOfDays = 8.276628d;

            var actual   = taskPlanner.GetTaskFinishingDate(start, numberOfDays);
            var expected = new DateTime(2004, 6, 4, 10, 12, 0);

            NUnit.Framework.Assert.AreEqual(expected, actual);
        }
示例#2
0
        public void GetTaskFinishDate_DecreaseDaysAndTime_IfStartTimeIsAfterTheWorDayStopTimeAndWorkingDaysIsNegative2()
        {
            //Arrange
            var taskPlanner = new TaskPlanner();

            //Act
            taskPlanner.SetWorkdayStartAndStop(new TimeSpan(8, 0, 0), new TimeSpan(16, 0, 0));
            taskPlanner.SetRecuringHolidays(new DateTime(2004, 5, 17, 0, 0, 0));
            taskPlanner.SetHolidays(new DateTime(2004, 5, 27, 0, 0, 0));

            var    start        = new DateTime(2004, 5, 24, 18, 03, 0);
            double numberOfDays = -6.7470217;

            var actual   = taskPlanner.GetTaskFinishDate(start, numberOfDays);
            var expected = new DateTime(2004, 5, 13, 10, 02, 0);

            //Assert
            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
示例#3
0
        public void GetTaskFinishDate_IncreaseDaysAndTime_IfStartTimeIsEarlyAndWorkingDaysIsPositive()
        {
            //Arrange
            var taskPlanner = new TaskPlanner();

            //Act
            taskPlanner.SetWorkdayStartAndStop(new TimeSpan(8, 0, 0), new TimeSpan(16, 0, 0));
            taskPlanner.SetRecuringHolidays(new DateTime(2004, 5, 17, 0, 0, 0));
            taskPlanner.SetHolidays(new DateTime(2004, 5, 27, 0, 0, 0));

            var    start        = new DateTime(2004, 5, 24, 07, 03, 0);
            double numberOfDays = 8.276628;

            var actual   = taskPlanner.GetTaskFinishDate(start, numberOfDays);
            var expected = new DateTime(2004, 6, 4, 10, 12, 0);

            //Assert
            Assert.AreEqual(expected.ToString(), actual.ToString());
        }