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 TestEnrollStudentToCourseArgumentExeption()
 {
     School newSchool = new School("smg");
     newSchool.EnrollStudentToCourse(null, 1);
 }
Exemplo n.º 5
0
 public void TestCoursesListDefaultMsg()
 {
     School newSchool = new School("smg");
     Assert.AreEqual("Sorry, there are no courses in this school", newSchool.CoursesList());
 }
Exemplo n.º 6
0
 public void TestAddStudentArgumentExeption()
 {
     School newSchool = new School("smg");
     newSchool.AddStudent(null);
 }
Exemplo n.º 7
0
 public void TestAddStudent()
 {
     School newSchool = new School("smg");
     newSchool.AddStudent("Petkan");
 }
Exemplo n.º 8
0
 public void TestAddCourseArgumentExeption()
 {
     School newSchool = new School("smg");
     newSchool.AddCourse(null);
 }
Exemplo n.º 9
0
 public void TestGetNextFreeIdArgumentOutOfRangeException()
 {
     School newSchool = new School("smg");
     for (int i = 0; i < 1000001; i++)
     {
         newSchool.AddStudent(i.ToString());
     }
 }
Exemplo n.º 10
0
 public void DismissStudentFromCourseArgumentOutOfRangeException()
 {
     School newSchool = new School("smg");
     newSchool.DismissStudentFromCourse("Ivan Ivanov", 1);
 }
Exemplo n.º 11
0
 public void DismissStudentFromCourseArgumentExeption()
 {
     School newSchool = new School("smg");
     newSchool.DismissStudentFromCourse(null, 1);
 }
Exemplo n.º 12
0
 public void TestToStringEmpty()
 {
     School newSchool = new School("smg");
     StringBuilder result = new StringBuilder();
     result.AppendLine(newSchool.CoursesList());
     result.AppendLine(newSchool.StudentsList());
     Assert.AreEqual(result.ToString(), newSchool.ToString());
 }
Exemplo n.º 13
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());
        }
Exemplo n.º 14
0
 public void TestStudentsListDefaultMsg()
 {
     School newSchool = new School("smg");
     Assert.AreEqual("Sorry, there are no students in this school", newSchool.StudentsList());
 }
Exemplo n.º 15
0
 public void TestSchoolCtor()
 {
     School newSchool = new School(null);
 }
Exemplo n.º 16
0
 public void TestEnrollStudentToCourseArgumentOutOfRangeException()
 {
     School newSchool = new School("smg");
     newSchool.EnrollStudentToCourse("Ivan Ivanov", 1);
 }
Exemplo n.º 17
0
 public void TestAddCourse()
 {
     School newSchool = new School("smg");
     newSchool.AddCourse("Math");
 }
Exemplo n.º 18
0
 public void TestGetNameArgumentException()
 {
     School newSchool = new School("smg");
     string name = newSchool.Name;
     newSchool.Name = null;
 }