示例#1
0
        public void GenerateScheduleTest()
        {
            IScheduleManager scheduleManager = new ScheduleManager(_scheduleAccessor,
                                                                   _shiftTimeAccessor);

            List <BaseScheduleLine> lines = new List <BaseScheduleLine>
            {
                new BaseScheduleLine
                {
                    BaseScheduleID = 1000000,
                    DepartmentID   = "Management",
                    ShiftTimeID    = 100002,
                    ERoleID        = "Manager",
                    Count          = 1
                }
            };

            DateTime date = DateTime.Now;

            ScheduleVM scheduleVM = scheduleManager.GenerateSchedule(date, lines);

            int result = scheduleVM.ScheduleLines.Count;
            int target = 10;

            Assert.AreEqual(target, result);
        }
示例#2
0
        public void TestGenerateScheduleCountTooHigh()
        {
            IScheduleManager scheduleManager = new ScheduleManager(_scheduleAccessor, _shiftTimeAccessor);

            // To ensure the list is at capacity.
            List <ScheduleVM> scheduleVMs = new List <ScheduleVM>
            {
                new ScheduleVM()
                {
                    ScheduleID     = 1000003,
                    CreatingUserID = 100000,
                    StartDate      = DateTime.Now.AddDays(15),
                    EndDate        = DateTime.Now.AddDays(29),
                    Active         = true,
                    CreatorName    = "Last, First",
                    ScheduleLines  = new List <ShiftUserVM>()
                },
                new ScheduleVM()
                {
                    ScheduleID     = 1000004,
                    CreatingUserID = 100000,
                    StartDate      = DateTime.Now.AddDays(30),
                    EndDate        = DateTime.Now.AddDays(44),
                    Active         = true,
                    CreatorName    = "Last, First",
                    ScheduleLines  = new List <ShiftUserVM>()
                }
            };

            foreach (var item in scheduleVMs)
            {
                scheduleManager.AddSchedule(item);
            }
            List <BaseScheduleLine> lines = new List <BaseScheduleLine>
            {
                new BaseScheduleLine
                {
                    BaseScheduleID = 1000000,
                    DepartmentID   = "Management",
                    ShiftTimeID    = 100002,
                    ERoleID        = "Manager",
                    Count          = 1
                }
            };

            DateTime date = DateTime.Now;

            ScheduleVM scheduleVM = scheduleManager.GenerateSchedule(date, lines);
        }