Пример #1
0
        public InstructorClassesTest()
        {
            //NEW INSTRUCTOR NAMED instructor AND A NEW COURSE NAMED crs
            Instructor instructor = new Instructor("Wayne", "Masters");
            Course     crs        = new Course("SD234", "Programming I");

            for (int i = 0; i < 3; i++)
            {
                _Class cls = new _Class(crs);
                cls.AddClassToInstructor(instructor);
            }

            ArrayList classes = instructor.GetClasses();

            string output = "Instructor " + instructor.GetInstructorId() + " has " + classes.Count + " classes." + "\r\n";

            output += "\r\n Classes for instructor " + instructor.GetInstructorId() + ":\r\n";

            for (int i = 0; i < classes.Count; ++i)
            {
                string cl = classes[i].ToString();
                output += "\t" + cl + "\r\n";
            }

            output += "\r\n  The instructor for class " + ((_Class)classes[0]).GetClassID() + ":\r\n";
            output += " " + ((_Class)classes[0]).GetInstructor().ToString() + "\r\n";
            output += "\r\n  Class info & instructor for class " + ((_Class)classes[0]).GetClassID() + ":\r\n";
            output += " " + ((_Class)classes[0]).GetCourse() + " " + ((_Class)classes[0]).ToString() + "\r\n";

            frmResultsDisplay theForm = new frmResultsDisplay(output, "Instructor Classes Test");

            theForm.ShowDialog();
        }
        public CourseClassesTest()
        {
            Course     crs  = new Course("SD254", "Programming II");
            Instructor ins1 = new Instructor("Knows", "Alot");
            Instructor ins2 = new Instructor("Talks", "Toofast");

            _Class cls = new _Class(crs);

            cls.AddClassToInstructor(ins1);

            cls = new _Class(crs);
            cls.AddClassToInstructor(ins1);

            ArrayList classes = crs.GetClasses();
            string    output  = " Course " + crs.GetCourseCode() + " has " + classes.Count + " classes." + "\r\n";

            output += "\r\n Classes for course " + crs.GetCourseCode() + ":\r\n";

            for (int i = 0; i < classes.Count; ++i)
            {
                string cl = classes[i].ToString();
                output += "\t" + cl + "\r\n";
            }
            output += "\r\n The course for class " + ((_Class)classes[0]).GetClassID() + ":\r\n";
            output += " " + ((_Class)classes[0]).GetCourse() + ":\r\n";

            frmResultsDisplay theForm = new frmResultsDisplay(output, "Course Classes Test");

            theForm.ShowDialog();
        }
Пример #3
0
        public InstructorOfficeTest2()
        {
            Instructor instructorOne = new Instructor("William", "Hayes");
            Room       officeOne     = new Room("Main", 201, Room.OFFICE);

            instructorOne.SetInstOffice(officeOne);
            officeOne.SetInstructorRoom(instructorOne);

            Instructor instructorTwo = new Instructor("Andrea", "Baker");
            Room       officeTwo     = new Room("Main", 202, Room.OFFICE);

            instructorTwo.SetInstOffice(officeTwo);
            officeTwo.SetInstructorRoom(instructorTwo);

            string output = " The office is " + instructorOne.GetInstOffice() + "\r\n";

            output += " The instructor is " + officeOne.GetInstructorRoom() + "\r\n";

            output += " The office is " + instructorTwo.GetInstOffice() + "\r\n";

            output += " The instructor is " + officeTwo.GetInstructorRoom() + "\r\n";

            frmResultsDisplay theForm = new frmResultsDisplay(output, "Instructor Office Test2");

            theForm.ShowDialog();
        }
        public EnrollmentTest()
        {
            ArrayList enrollments = new ArrayList();
            string    output;

            Student[] std =
            {
                new Student("Heez",  "Student", "A"),
                new Student("I'm",   "Winner",  "A"),
                new Student("Sheez", "Walker",  "A"),
                new Student("They",  "Runners", "R"),
                new Student("Will",  "Goh",     "E")
            };
            Course crs1 = new Course("SD234", "Programming I");
            Course crs2 = new Course("SD254", "Programming II");

            _Class[] cls =
            {
                new _Class(crs1),
                new _Class(crs2),
                new _Class(crs1),
                new _Class(crs2),
                new _Class(crs1)
            };

            for (int i = 0; i < 5; ++i)
            {
                Enrollment enr = new Enrollment();

                enr.SetClass(cls[i]);
                cls[i].AddEnrollment(enr);
                enr.SetStudent(std[i]);
                std[i].AddEnrollment(enr);
                enrollments.Add(enr);
            }

            ArrayList results = new ArrayList();

            foreach (Enrollment e in enrollments)
            {
                output  = " " + e.GetClass().GetCourse() + "\r\n";
                output += "\t" + e + "\r\n";
                results.Add(output);
            }

            results.Sort();

            output = " ENROLLMENT\r\n";
            foreach (string str in results)
            {
                output += str;
            }

            frmResultsDisplay theForm = new frmResultsDisplay(output, "Enrollment Test");

            theForm.ShowDialog();
        }
Пример #5
0
        public CourseTest()
        {
            string output = "";

            Course[] course = { new Course("Programming 2", "SD254") };

            for (int i = 0; i < course.Length; ++i)
            {
                output += course[i] + "\r\n";
            }

            frmResultsDisplay theForm = new frmResultsDisplay(output, "Course PD Test");

            theForm.ShowDialog();
        }
        public StudentTest()
        {
            string output = "";

            Student[] student = { new Student("Joe", "Kigin", "P.") };

            for (int i = 0; i < student.Length; ++i)
            {
                output += " " + student[i] + "\r\n";
            }

            frmResultsDisplay theForm = new frmResultsDisplay(output, "Student PD Test");

            theForm.ShowDialog();
        }
        public InstructorOfficeTest1()
        {
            Instructor theInstructor = new Instructor("Bill", "Hayes");
            Room       anOffice      = new Room("Main", 201, Room.OFFICE);

            theInstructor.SetInstOffice(anOffice);

            string output = " The instructor is " + theInstructor + ".\r\n";

            Room theOffice = theInstructor.GetInstOffice();

            output += " The office is " + theOffice + ".\r\n";

            output += " Again, the office is " + theInstructor + ".\r\n";

            frmResultsDisplay theForm = new frmResultsDisplay(output, "Instuctor Office Test1");

            theForm.ShowDialog();
        }
Пример #8
0
        public BlockTest()
        {
            string output = "";

            //Sample blocks 1-5
            Block[] block = { new Block(1, new DateTime(1, 1, 1,  8, 30, 0), new DateTime(1, 1, 1, 10, 20, 0)),
                              new Block(2, new DateTime(1, 1, 1, 10, 30, 0), new DateTime(1, 1, 1, 12, 20, 0)),
                              new Block(3, new DateTime(1, 1, 1, 12, 30, 0), new DateTime(1, 1, 1, 14, 20, 0)),
                              new Block(4, new DateTime(1, 1, 1, 14, 30, 0), new DateTime(1, 1, 1, 16, 20, 0)),
                              new Block(5, new DateTime(1, 1, 1, 18, 00, 0), new DateTime(1, 1, 1, 22, 00, 0)) };

            //Output format
            for (int i = 0; i < block.Length; ++i)
            {
                output += " " + block[i] + "\r\n";
            }

            frmResultsDisplay theForm =
                new frmResultsDisplay(output, "Block PD Test");

            theForm.ShowDialog();
        }
Пример #9
0
        public DayTest()
        {
            string output = "";

            //Days Monday-Saturday
            Day [] day = { new Day("M", "Monday"),
                           new Day("T", "Tuesday"),
                           new Day("W", "Wednesday"),
                           new Day("R", "Thursday"),
                           new Day("F", "Friday"),
                           new Day("S", "Saturday") };

            //Output format
            for (int i = 0; i < day.Length; ++i)
            {
                output += " " + day[i] + "\r\n";
            }
            frmResultsDisplay theForm =
                new frmResultsDisplay(output, "Day PD Test");

            theForm.ShowDialog();
        }
        public RoomTest()
        {
            string output = "";

            //Sample rooms 1-5
            Room[] room = { new Room("Main",     101, Room.OFFICE),
                            new Room("Main",     201, Room.CLASSROOM),
                            new Room("Main",     301, Room.OFFICE),
                            new Room("Ball Pit", 101, Room.CLASSROOM),
                            new Room("Ball Pit", 105, Room.OFFICE) };

            //Output format
            for (int i = 0; i < room.Length; ++i)
            {
                output += " " + room[i] + "\r\n";
            }


            frmResultsDisplay theForm =
                new frmResultsDisplay(output, "Room PD Test");

            theForm.ShowDialog();
        }
Пример #11
0
        public CourseDATest()
        {
            ArrayList theCourses;
            Course    foundCourse;
            string    output = "";

            //Initialize with starting contents
            Course.Initialize();

            //Create and add two database courses
            Course dbCourse1 = new Course("DB211", "Database Design");
            Course dbCourse2 = new Course("DB311", "Database Implementation");

            dbCourse1.AddNew();
            dbCourse2.AddNew();

            //Display modified contents
            theCourses = Course.GetAll();
            for (int i = 0; i < theCourses.Count; ++i)
            {
                output += " " + theCourses[i] + "\r\n";
            }

            output += "\r\n";

            //Search for course
            foundCourse = Course.Find("SD254");
            if (foundCourse == null)
            {
                output += " SD245 Not Found" + "\r\n";
            }
            else
            {
                output += " Found" + foundCourse.ToString() + "\r\n";
            }

            //Search for another course
            foundCourse = Course.Find("DB200");
            if (foundCourse == null)
            {
                output += " DB200 Not Found" + "\r\n";
            }
            else
            {
                output += " Found" + foundCourse.ToString() + "\r\n";
            }

            //Delete a course
            output += "\r\n" + "After deleting BD211: " + "\r\n";
            dbCourse1.Delete();
            for (int i = 0; i < theCourses.Count; ++i)
            {
                output += " " + theCourses[i] + "\r\n";
            }
            output += "\r\n";

            //Update a course
            foundCourse = Course.Find("SD234");
            if (foundCourse != null)
            {
                foundCourse.SetCourseName("C# Programming 1");
            }
            foundCourse = Course.Find("SD254");
            if (foundCourse != null)
            {
                foundCourse.SetCourseName("C# Programming 2");
            }

            output += "After updating: " + "\r\n";
            for (int i = 0; i < theCourses.Count; ++i)
            {
                output += " " + theCourses[i] + "\r\n";
            }

            frmResultsDisplay theForm = new frmResultsDisplay(output, "Course PD Test");

            theForm.ShowDialog();
        }