Esempio n. 1
0
        public void SickOnSundayTest()
        {
            IFilter sickOrDayOff = new FilterSickOrDayOff();

            List <Employee>        employees        = GenerateEmployeeList();
            List <Shift>           shifts           = GenerateShiftList();
            List <WorkingEmployee> workingEmployees = GenerateWorkingEmployeeList();

            List <Employee> controlEmployees = new List <Employee>(employees);

            controlEmployees.RemoveAll(employee => employee.Id == 19);

            List <Employee> availableEmployees = sickOrDayOff.Filter(shifts[19], 1, shifts, workingEmployees, employees);

            CollectionAssert.AreEquivalent(controlEmployees, availableEmployees);
        }
Esempio n. 2
0
        public void AllFiltersMondayTest()
        {
            IFilter alreadyScheduled       = new FilterAlreadyScheduled();
            IFilter sickOrDayOff           = new FilterSickOrDayOff();
            IFilter scheduledTwice         = new FilterScheduledTwiceAlready();
            IFilter notAllowedInDepartment = new FilterNotAllowedInDepartment();
            IFilter otherDepartment        = new FilterWorkingInOtherDepartmentToday();
            IFilter contractHours          = new FilterContractHoursViolation();
            IFilter preferredHours         = new FilterPreferredHours();


            List <Employee>        employees          = GenerateEmployeeList();
            List <Shift>           shifts             = GenerateShiftList();
            List <WorkingEmployee> workingEmployees   = GenerateWorkingEmployeeList();
            List <Employee>        availableEmployees = new List <Employee>(employees);
            Shift shift        = shifts[2];
            int   departmentId = 3;

            List <Employee> controlEmployees = new List <Employee>(employees);

            availableEmployees = alreadyScheduled.Filter(shift, departmentId, shifts, workingEmployees, availableEmployees);
            controlEmployees.RemoveAll(employee => employee.Id == 2);

            availableEmployees = sickOrDayOff.Filter(shift, departmentId, shifts, workingEmployees, availableEmployees);
            controlEmployees.RemoveAll(employee => employee.Id == 10);

            availableEmployees = scheduledTwice.Filter(shift, departmentId, shifts, workingEmployees, availableEmployees);
            controlEmployees.RemoveAll(employee => employee.Id == 1);

            availableEmployees = notAllowedInDepartment.Filter(shift, departmentId, shifts, workingEmployees, availableEmployees);
            controlEmployees.RemoveAll(employee => employee.Id == 7);

            availableEmployees = otherDepartment.Filter(shift, departmentId, shifts, workingEmployees, availableEmployees);
            controlEmployees.RemoveAll(employee => employee.Id == 15);

            availableEmployees = contractHours.Filter(shift, departmentId, shifts, workingEmployees, availableEmployees);
            controlEmployees.RemoveAll(employee => employee.Id == 20);
            controlEmployees.RemoveAll(employee => employee.Id == 21);

            availableEmployees = preferredHours.Filter(shift, departmentId, shifts, workingEmployees, availableEmployees);
            controlEmployees.RemoveAll(employee => employee.Id == 3);
            controlEmployees.RemoveAll(employee => employee.Id == 4);
            controlEmployees.RemoveAll(employee => employee.Id == 5);
            controlEmployees.RemoveAll(employee => employee.Id == 6);

            CollectionAssert.AreEquivalent(controlEmployees, availableEmployees);
        }