Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            try
            {
                School SMG = new School("Sofia Math Gymnasium");
                Console.WriteLine(SMG.ToString());

                SMG.AddStudent("Ivan Ivanov");
                SMG.AddStudent("Georgi Georgiev");
                SMG.AddStudent("Ivan Georgiev");
                SMG.AddStudent("Georgi Ivanov");

                SMG.AddCourse("Biology");
                SMG.AddCourse("Mathematics");

                // First we get the list of student to find which student id we need!
                SMG.EnrollStudentToCourse("Biology", 10001);
                SMG.EnrollStudentToCourse("Biology", 10002);
                SMG.EnrollStudentToCourse("Biology", 10000);
                // SMG.EnrollStudentToCourse("Biology", 10000); // Exception thrown: "The student you are trying to enroll is allready enrolled in this course"

                SMG.DismissStudentFromCourse("Biology", 10000);
                // SMG.DismissStudentFromCourse("Biology", 10000); // Exception thrown: "There is no such student in this course"

                Console.WriteLine(SMG.ToString());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Exemplo n.º 2
0
 public void TestEnrollStudentToCourse()
 {
     School newSchool = new School("smg");
     newSchool.AddStudent("Ivan");
     newSchool.AddCourse("Math");
     newSchool.EnrollStudentToCourse("Math", 10000);
 }
Exemplo n.º 3
0
 public void DismissStudentFromCourse()
 {
     School newSchool = new School("smg");
     newSchool.AddStudent("Ivan");
     newSchool.AddCourse("Math");
     newSchool.EnrollStudentToCourse("Math", 10000);
     newSchool.DismissStudentFromCourse("Math", 10000);
 }
Exemplo n.º 4
0
 public void TestAddCourseArgumentExeption()
 {
     School newSchool = new School("smg");
     newSchool.AddCourse(null);
 }
Exemplo n.º 5
0
 public void TestAddCourse()
 {
     School newSchool = new School("smg");
     newSchool.AddCourse("Math");
 }
Exemplo n.º 6
0
        public void TestToString()
        {
            School SMG = new School("Sofia Math Gymnasium");

            SMG.AddStudent("Ivan Ivanov");
            SMG.AddStudent("Georgi Georgiev");
            SMG.AddStudent("Ivan Georgiev");
            SMG.AddStudent("Georgi Ivanov");

            SMG.AddCourse("Biology");
            SMG.AddCourse("Mathematics");

            SMG.EnrollStudentToCourse("Biology", 10001);
            SMG.EnrollStudentToCourse("Biology", 10002);
            SMG.EnrollStudentToCourse("Biology", 10000);

            string expected =
                @"Course Name: Biology Enrolled Students: 3
            Course Name: Mathematics Enrolled Students: 0

            Id: 10000  Name: Ivan Ivanov
            Id: 10001  Name: Georgi Georgiev
            Id: 10002  Name: Ivan Georgiev
            Id: 10003  Name: Georgi Ivanov

            ";

            Assert.AreEqual(expected, SMG.ToString());
        }