public void HasOPWorkTest1()
        {
            Hour hour;
            Hour scheduleHour = new Hour(100);

            schedule1.Add(scheduleHour, allocatedCase);

            int preparationHours = chair.GetParameters(WorkerRole.Chair).HoursOPPrepration;

            for (int i = 0; i < scheduleHour.Value - preparationHours; i++)  // default chair has 4 hours of preparation
            {
                hour = new Hour(i);
                Assert.IsFalse(
                    schedule1.HasOPWork(hour, allocatedCase.Board.Chair.Member),
                    "Failed at " + hour);
            }

            Hour endHour = scheduleHour.AddHours(TimeParameters.OPDurationInHours);

            for (int i = scheduleHour.Value - preparationHours;
                 i < endHour.Value;
                 i++)
            {
                hour = new Hour(i);
                Assert.IsTrue(schedule1.HasOPWork(hour, allocatedCase.Board.Chair.Member),
                              "Failed at " + hour);
            }

            Assert.IsFalse(schedule1.HasOPWork(endHour, allocatedCase.Board.Chair.Member),
                           "Failed at " + endHour);
        }
        public void GetOPWorkTest0()
        {
            Hour scheduleHour     = new Hour(100);
            Hour endHour          = scheduleHour.AddHours(TimeParameters.OPDurationInHours);
            int  preparationHours = chair.GetParameters(WorkerRole.Chair).HoursOPPrepration;

            schedule0.Add(scheduleHour, allocatedCase);

            foreach (Hour hour in
                     new SimulationTimeSpan(
                         new Hour(0),
                         scheduleHour.SubtractHours(preparationHours).Previous()))
            {
                Assert.IsNull(
                    schedule0.GetOPWork(hour, allocatedCase.Board.Chair.Member),
                    "Failed at " + hour);
            }

            foreach (Hour hour in
                     new SimulationTimeSpan(
                         scheduleHour.SubtractHours(preparationHours),
                         endHour.Previous()))
            {
                Assert.AreEqual(
                    schedule0.GetOPWork(hour, allocatedCase.Board.Chair.Member),
                    allocatedCase,
                    "Failed at " + hour);
            }

            Assert.IsNull(schedule0.GetOPWork(endHour, allocatedCase.Board.Chair.Member),
                          "Failed at " + endHour);
        }
        public void AddHoursTest()
        {
            DateTime now     = ClockProxy.Clock.Now;
            DateTime nowHour = new DateTime(now.Year, now.Month, now.Day, now.Hour, 0, 0);
            Hour     hour    = new Hour(now, TimeCalendar.New(TimeSpan.Zero, TimeSpan.Zero));

            Assert.AreEqual(hour.AddHours(0), hour);

            DateTime previousHour = nowHour.AddHours(-1);

            Assert.AreEqual(hour.AddHours(-1).Year, previousHour.Year);
            Assert.AreEqual(hour.AddHours(-1).Month, previousHour.Month);
            Assert.AreEqual(hour.AddHours(-1).Day, previousHour.Day);
            Assert.AreEqual(hour.AddHours(-1).HourValue, previousHour.Hour);

            DateTime nextHour = nowHour.AddHours(1);

            Assert.AreEqual(hour.AddHours(1).Year, nextHour.Year);
            Assert.AreEqual(hour.AddHours(1).Month, nextHour.Month);
            Assert.AreEqual(hour.AddHours(1).Day, nextHour.Day);
            Assert.AreEqual(hour.AddHours(1).HourValue, nextHour.Hour);
        }         // AddHoursTest
        public void GetNextHourTest()
        {
            Hour hour = new Hour();

            Assert.AreEqual(hour.GetNextHour(), hour.AddHours(1));
        }         // GetNextHourTest
        public void GetPreviousHourTest()
        {
            Hour hour = new Hour();

            Assert.AreEqual(hour.GetPreviousHour(), hour.AddHours(-1));
        }         // GetPreviousHourTest
Exemple #6
0
 public void AddHoursTest()
 {
     Assert.AreEqual(ten, zero.AddHours(10));
 }