Example #1
0
        public void SchoolVanStudentAssignmentSuccess()
        {
            SetUp();
            List <Tuple <SchoolVan, List <Student> > > expectedValue = new List <Tuple <SchoolVan, List <Student> > >();
            StudentLogic   testLogic      = new StudentLogic();
            SchoolVanLogic schoolVanLogic = new SchoolVanLogic();
            Student        newStudent     = TestStudent(100);

            testLogic.Add(newStudent);
            newStudent.Id = testLogic.GetNextIdFree() - 1;

            Student lastStudent = TestStudent(200);

            testLogic.Add(lastStudent);
            lastStudent.Id = testLogic.GetNextIdFree() - 1;

            Student otherStudent = TestStudent(300);

            testLogic.Add(otherStudent);
            otherStudent.Id = testLogic.GetNextIdFree() - 1;

            Student anotherStudent = TestStudent(400);

            testLogic.Add(anotherStudent);
            anotherStudent.Id = testLogic.GetNextIdFree() - 1;

            SchoolVanLogic logic        = new SchoolVanLogic();
            SchoolVan      newSchoolVan = new SchoolVan();

            newSchoolVan.Id       = 15;
            newSchoolVan.Capacity = 10;
            logic.Add(newSchoolVan);
            List <Student> firstStudentList = new List <Student>();

            firstStudentList.Add(newStudent);
            firstStudentList.Add(lastStudent);
            SchoolVan anotherSchoolVan = new SchoolVan();

            anotherSchoolVan.Id       = 25;
            anotherSchoolVan.Capacity = 14;
            logic.Add(anotherSchoolVan);
            List <Student> nextStudentList = new List <Student>();

            nextStudentList.Add(otherStudent);
            nextStudentList.Add(anotherStudent);
            Tuple <SchoolVan, List <Student> > firstTouple = new Tuple <SchoolVan, List <Student> >(anotherSchoolVan, firstStudentList);
            Tuple <SchoolVan, List <Student> > nextTouple  = new Tuple <SchoolVan, List <Student> >(newSchoolVan, nextStudentList);

            expectedValue.Add(firstTouple);
            expectedValue.Add(nextTouple);
            List <Tuple <SchoolVan, List <Student> > > ObtainValue = logic.StudentAssignment();

            Assert.IsTrue(CompareStudentAssignment(ObtainValue, expectedValue));
        }