Example #1
0
        public void TestStudentsOrderedByDistanceToSchool()
        {
            IVehicleLogic vehicleOperations = DummyProvider.GetInstance.GetVehicleOperations();
            IStudentLogic studentOperations = DummyProvider.GetInstance.GetStudentOperations();

            Student studentOne = new Student();

            studentOne.Document          = "1234567-1";
            studentOne.Name              = "John";
            studentOne.Location          = new Location(2.00000, 2.000000);
            studentOne.HavePickUpService = true;
            studentOne.StudentNumber     = 1;

            Student studentTwo = new Student();

            studentTwo.Document          = "1234567-2";
            studentTwo.Name              = "George";
            studentTwo.Location          = new Location(1.00000, 1.000000);
            studentTwo.HavePickUpService = true;
            studentTwo.StudentNumber     = 2;

            Student studentThree = new Student();

            studentThree.Document          = "1234567-3";
            studentThree.Name              = "Paul";
            studentThree.Location          = new Location(3.00000, 3.000000);
            studentThree.HavePickUpService = true;
            studentThree.StudentNumber     = 3;

            Student studentFour = new Student();

            studentFour.Document          = "1234567-4";
            studentFour.Name              = "Ringo";
            studentFour.Location          = new Location(20.00000, 20.000000);
            studentFour.HavePickUpService = true;
            studentFour.StudentNumber     = 4;

            studentOperations.AddStudent(studentOne);
            studentOperations.AddStudent(studentTwo);
            studentOperations.AddStudent(studentThree);
            studentOperations.AddStudent(studentFour);


            Student studentToCompare1 = studentOperations.GetStudentByDocumentNumber(studentOne.Document);
            Student studentToCompare2 = studentOperations.GetStudentByDocumentNumber(studentTwo.Document);
            Student studentToCompare3 = studentOperations.GetStudentByDocumentNumber(studentThree.Document);
            Student studentToCompare4 = studentOperations.GetStudentByDocumentNumber(studentFour.Document);

            var studentsOrderedByDistanceToSchool = vehicleOperations.StudentsOrderedByDistanceToSchool();

            Assert.AreEqual(studentsOrderedByDistanceToSchool[0].Item1, studentToCompare2);
            Assert.AreEqual(studentsOrderedByDistanceToSchool[1].Item1, studentToCompare1);
            Assert.AreEqual(studentsOrderedByDistanceToSchool[2].Item1, studentToCompare3);
            Assert.AreEqual(studentsOrderedByDistanceToSchool[3].Item1, studentToCompare4);
        }