상속: ICommentable, IEnumerable
예제 #1
0
        public void TestStudentsCreationWithExistingOneShouldThrowException()
        {
            var testSchool = new School.School("testSchoolName");

            testSchool.GenerateStudent("Test Student Name", 10001);
            testSchool.GenerateStudent("Test Student Name Two", 10001);
        }
예제 #2
0
        public void TestAddingNullCourse()
        {
            School.School s = new School.School("MySchool");
            Course        c = null;

            s.AddCourse(c);
        }
예제 #3
0
 public void TestGetListOfCoursesPropertyShouldReturnDeepCopyOfTheList()
 {
     var testSchool = new School.School("Test School");
     testSchool.GenerateCourse("Test Course Name");
     Assert.AreNotSame(testSchool.ListOfCourses[0], testSchool.ListOfCourses[0],
         "Courses list property returns same course as first member, but should be copy.");
 }
예제 #4
0
        public void TestSeveralCoursesWithSameName()
        {
            School.School s  = new School.School("bar");
            Course        c  = new Course("Math");
            Course        c1 = new Course("alpha");
            Course        c2 = new Course("beta");
            Course        c3 = new Course("gama");
            Course        c4 = new Course("Math");
            Course        c5 = new Course("Math");

            s.AddCourse(c);
            s.AddCourse(c1);
            s.AddCourse(c2);
            s.AddCourse(c3);
            s.AddCourse(c4);
            s.AddCourse(c5);

            Course removed = s.RemoveCourse("Math");

            bool result = removed == c;

            result = result && s.Courses[0] == c1 &&
                     s.Courses[1] == c2 && s.Courses[2] == c3 &&
                     s.Courses[3] == c4 && s.Courses[4] == c5;

            Assert.IsTrue(result);
        }
예제 #5
0
        static void Main()
        {
            //Students
            Student firstStudent = new Student("Pesho", "Kamburov", 1);
            Student secondStudent = new Student("Galin", "Imamov", 2);

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Students:");
            Console.ResetColor();
            Console.WriteLine(firstStudent.ToString());
            Console.WriteLine(secondStudent.ToString());
            //Teachers
            Teacher firstTeacher = new Teacher("Stefan", "Popov");
            firstTeacher.AddDiscipline(new Discipline("Math", 16, 10));
            firstTeacher.AddDiscipline(new Discipline("Physics", 20, 5));
            Teacher secondTeacher = new Teacher("Armin", "Van Buuren");
            secondTeacher.AddDiscipline(new Discipline("TechMusic", 15, 5));
            secondTeacher.AddDiscipline(new Discipline("Minimal", 18, 7));

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("\nTeachers:");
            Console.ResetColor();
            Console.WriteLine(firstTeacher.ToString());
            Console.WriteLine(secondTeacher.ToString());

            //School
            School school = new School();

            school.AddClass(new Class("12b", firstTeacher));
            school.AddClass(new Class("12a", secondTeacher));
        }
예제 #6
0
 public Student(string name, int number, School school)
 {
     this.School = school;
     this.Name = name;
     this.UniqueNumber = number;
     this.School.Students.Add(this.UniqueNumber, this);
 }
 public void Student_AddingStudentsWithDifferentCredentials()
 {
     School mySchool = new School();
     Student pesho = new Student("pesho", 12344, mySchool);
     Student gosho = new Student("gosho", 12345, mySchool);
     Assert.AreNotEqual(pesho.UniqueNumber, gosho.UniqueNumber);
 }
예제 #8
0
        //this method will display all the school info from a given scholl(without the comments)
        public static void DisplayTest(School temp)
        {
            Console.WriteLine("\nSchool name: " + temp.Name);

            Console.WriteLine("\nClasses:\n");

            foreach(Class classInSchool in temp.Classes)
               {
                   Console.WriteLine(classInSchool.Name);
                   Console.WriteLine();
                   Student.DisplayStudents(classInSchool.Students);
                   Console.WriteLine("\nTeachers : \n");

                   foreach (Teacher teacher in classInSchool.Teachers)
                   {
                       Console.Write(teacher.Name);
                       Console.WriteLine();

                       foreach (Discipline discipline in teacher.Disciplines)
                       {
                           Console.Write("\n"+discipline.Name + " " + discipline.LecturesCount + " hours lectures and " + discipline.ExercisesCount + " hours exercises");
                       }
                       Console.WriteLine();
                   }

                   Console.WriteLine();
               }
        }
예제 #9
0
 public void AddStudent(School school, Student student)
 {
     if (school.Courses.Single(x => x.Equals(this)) != null)
     {
         this.students.Add(student);
     }
 }
        public static void Main()
        {
            var tupacDisciplines = new List<Discipline>
            {
                new Discipline(DisciplineName.Music, 10, 10),
                new Discipline(DisciplineName.History, 8, 8)
            };

            var studentsFromClassA = new List<Student>
            {
                new Student("Marshall", "Mathers"),
                new Student("Earl", "Simmons"),
                new Student("Mary", "Blige")
            };

            var studentsFromClassB = new List<Student>
            {
                new Student("William", "Roberts"),
                new Student("Dwayne", "Carter"),
                new Student("Kimberly", "Jones")
            };

            var teachers = new List<Teacher> 
            {
                new Teacher("Tupac", "Shakur", tupacDisciplines)
            };

            var classA = new SchoolClass(teachers, studentsFromClassA);
            var classB = new SchoolClass(teachers, studentsFromClassB);

            var school = new School(new List<SchoolClass> { classA, classB });

            Console.WriteLine(school);
        }
예제 #11
0
        static void Main()
        {
            School justSchool = new School("JustSchool");

            Teacher ivanov = new Teacher("Ivanov");
            Teacher metodiev = new Teacher("Metodiev");

            Student milko = new Student("Milko", 15);
            Student vasil = new Student("Vasil", 2);

            Class bClass = new Class("BClass");

            Discipline math = new Discipline("Math", 5, 10);
            Discipline chemistry = new Discipline("Chemistry", 5, 12);

            justSchool.Classes.Add(bClass);

            bClass.Students.Add(milko);
            bClass.Students.Add(vasil);
            bClass.Teachers.Add(ivanov);
            bClass.Teachers.Add(metodiev);

            ivanov.Disciplines.Add(math);
            metodiev.Disciplines.Add(chemistry);

            bClass.Comment = "Pros";
        }
예제 #12
0
        public void AddingCourseShouldIncreazeNumberOfCourses()
        {
            var school = new School();
            var course = new Course("pesho");
            school.AddCourse(course);

            Assert.AreEqual(1, school.CoursesCount, "Courses adding does not increaze count");
        }
예제 #13
0
        public void AddingStudentShouldIncreazeNumberOfStudents()
        {
            var school = new School();
            var student = new Student("pesho", 22222);
            school.AddStudent(student);

            Assert.AreEqual(1, school.StudentsCount, "Student adding does not increaze count");
        }
예제 #14
0
        public void TestGetListOfCoursesPropertyShouldReturnDeepCopyOfTheList()
        {
            var testSchool = new School.School("Test School");

            testSchool.GenerateCourse("Test Course Name");
            Assert.AreNotSame(testSchool.ListOfCourses[0], testSchool.ListOfCourses[0],
                              "Courses list property returns same course as first member, but should be copy.");
        }
예제 #15
0
        public void TestAddCourse1()
        {
            School school = new School("Telerik");
            Course course = new Course("JavaScript");

            school.AddCourse(course);
            Assert.AreEqual(1, school.Courses.Count, "Course was not added successfully.");
        }
예제 #16
0
        public void CanNotAddDifferentStudentsWithSameId()
        {
            var school = new School();
            var student1 = new Student("pesho", 22222);
            var student2 = new Student("gosho", 22222);

            school.AddStudent(student1);
            school.AddStudent(student2);
        }
예제 #17
0
        public void TestRemoveCourse2()
        {
            School school = new School("Telerik");
            Course course = new Course("JavaScript");

            school.AddCourse(course);
            school.RemoveCourse(new Course("Web"));
            Assert.AreEqual(0, school.Courses.Count, "Course was not removed successfully.");
        }
예제 #18
0
 public void TestGetNamePropertyShouldWorkProperly()
 {
     var testCourse = new School.School("testSchoolName");
     Assert.AreEqual(
         testCourse.Name,
         "testSchoolName",
         "Test school name is not equal to the one got from the property."
         );
 }
        public void Student_AddingStudentWithOutOfRangeNumberBiggerThan99998()
        {
            School mySchool = new School();
            for (int number = 10000; number < 100000; number++)
            {
                Student gosho = new Student("gosho", 110000, mySchool);
            }

            //Assert.Fail("Student's number is out of range");
        }
예제 #20
0
 public void TestGenerateStudentMethodShouldWorkProperly()
 {
     var testSchool = new School.School("Test School");
     testSchool.GenerateStudent("Test Student Name", 10001);
     Assert.AreEqual(
         testSchool.ListOfStudents[0].Name,
         "Test Student Name",
         "Generated student name is not equal to the one entered."
         );
 }
예제 #21
0
        public void TestGetNamePropertyShouldWorkProperly()
        {
            var testCourse = new School.School("testSchoolName");

            Assert.AreEqual(
                testCourse.Name,
                "testSchoolName",
                "Test school name is not equal to the one got from the property."
                );
        }
예제 #22
0
        public void TestGenerateStudentMethodShouldWorkProperly()
        {
            var testSchool = new School.School("Test School");

            testSchool.GenerateStudent("Test Student Name", 10001);
            Assert.AreEqual(
                testSchool.ListOfStudents[0].Name,
                "Test Student Name",
                "Generated student name is not equal to the one entered."
                );
        }
예제 #23
0
        public void InitializeSchool()
        {
            school = new School("School");
            firstCourse = new Course("Math");
            secondCourse = new Course("Bio");
            firstStudent = new Student("Ivan", 20000);
            secondStudent = new Student("Maria", 20000);

            firstCourse.AddStudent(firstStudent);
            school.AddCourse(firstCourse);
        }
예제 #24
0
 public void InitializeSchoolTest()
 {
     var school = new School("Telerik Academy");
     var javascript = new Course("Javascript");
     var pesho = new Student("Pesho", 10111);
     javascript.AddStudent(pesho);
     school.AddCourse(javascript);
     string expected = "Course number: 1\nCourse name: Javascript\nStudent name is: Pesho, with id: 10111\n";
     string actual = school.ToString();
     Assert.AreEqual(expected, actual);
 }
예제 #25
0
 public void RemoveCourseFromSchool()
 {
     var school = new School("Telerik Academy");
     var javascript = new Course("Javascript");
     var html = new Course("HTML");
     school.AddCourse(javascript);
     school.AddCourse(html);
     school.RemoveCourse(html);
     string expected = school.ToString();
     string actual = "Course number: 1\nCourse name: Javascript\n";
     Assert.AreEqual(expected, actual);
 }
        static void Main()
        {
            School scholl = new School("MG Petar Beron");

            SchoolClass schClass = new SchoolClass("4a");
            scholl.AddSchoolClass(schClass);

            Student student = new Student("Anna Dimova", 1);
            schClass.AddStudent(student);
            student = new Student("Biljana Asenova", 2);
            schClass.AddStudent(student);
            student = new Student("Georgi Ivanov", 3);
            schClass.AddStudent(student);
            student = new Student("Emil Stojanov", 4);
            schClass.AddStudent(student);

            Teacher teacherMath = new Teacher("Radka Petrova");
            Discipline discipline = new Discipline("Mathematics", 5, 2);
            teacherMath.AddDiscipline(discipline);
            discipline = new Discipline("Informatics", 3, 2);
            teacherMath.AddDiscipline(discipline);

            schClass.AddTeacher(teacherMath);

            Teacher teacherChem = new Teacher("Stojanka Stojanova");
            discipline = new Discipline("Chemistry", 5, 2);
            teacherChem.AddDiscipline(discipline);

            schClass.AddTeacher(teacherChem);

            Teacher teacherEng = new Teacher("Ivo Nikolov");
            discipline = new Discipline("Englich", 3, 1);
            teacherEng.AddDiscipline(discipline);

            schClass = new SchoolClass("4b");
            scholl.AddSchoolClass(schClass);

            student = new Student("Angel Dimov", 1);
            schClass.AddStudent(student);
            student = new Student("Bojan Ivanov", 2);
            schClass.AddStudent(student);
            student = new Student("Georgi Stojanov", 3);
            schClass.AddStudent(student);
            student = new Student("Emilija Dimova", 4);
            schClass.AddStudent(student);

            schClass.AddTeacher(teacherMath);
            schClass.AddTeacher(teacherChem);
            schClass.AddTeacher(teacherEng);

            Console.WriteLine(scholl);
        }
        static void Main()
        {
            
            List<Discipline> listOfDisciplines = new List<Discipline>();
            listOfDisciplines.Add(new Discipline("Physics", 10, 5));
            listOfDisciplines.Add(new Discipline("Football", 14, 53));
            listOfDisciplines.Add(new Discipline("Chemistry", 11, 2));
            listOfDisciplines.Add(new Discipline("Biology", 1, 20));
            listOfDisciplines.Add(new Discipline("Geography", 1, 5));

            List<Teacher> listOfTeachers = new List<Teacher>();
            listOfTeachers.Add(new Teacher("Pirinka", "Koleva", listOfDisciplines[4]));
            listOfTeachers[0].AddDiscipline(listOfDisciplines[2]);

            listOfTeachers.Add(new Teacher("Asparuh", "Senkov", listOfDisciplines[1]));
            listOfTeachers[1].AddDiscipline(listOfDisciplines[4]);

            listOfTeachers.Add(new Teacher("Pavel", "Apostolov", listOfDisciplines[0]));
            listOfTeachers[2].AddDiscipline(listOfDisciplines[3]);


            List<Student> allStudents = new List<Student>();
            allStudents.Add(new Student("ttt", "mmm", 1));
            allStudents.Add(new Student("mmm", "KKK", 2));
            allStudents.Add(new Student("ppp", "yyy", 3));
            allStudents.Add(new Student("aaa", "bbb", 4));
            allStudents.Add(new Student("www", "eee", 5));
            allStudents.Add(new Student("rrr", "ccc", 6));
            allStudents.Add(new Student("sss", "qqq", 7));
            allStudents.Add(new Student("zzz", "xxx", 8));

            List<SchoolClass> classes = new List<SchoolClass>();
            classes.Add(new SchoolClass("12a", new Teacher[] { listOfTeachers[0], listOfTeachers[1] },
                new Student[] { allStudents[0], allStudents[1], allStudents[2], allStudents[3] }));
            classes.Add(new SchoolClass("1a", new Teacher[] { listOfTeachers[2], listOfTeachers[0] },
                new Student[] { allStudents[5], allStudents[6], allStudents[7] }));

            School school = new School();
            school.AddClass(classes[0]);
            school.AddClass(classes[1]);

            SchoolClass getClass = school.GetClassByID("12a");
            Console.WriteLine("Original class: {0} \nNumber of students: {1}", getClass.GetUnqID, getClass.GetNumberOfStudents);
            getClass.AddStudent(allStudents[6]);
            Console.WriteLine("\nAdded a student to a class -\nclass: {0} \nNumber of students: {1} \nNumber of Teachers: {2}",
                getClass.GetUnqID, getClass.GetNumberOfStudents, getClass.GetNumberOfTeachers);
            getClass.RemoveStudent(allStudents[0]);
            Console.WriteLine("\nRemoved a student -\nclass: {0} \nstudents: {1}", getClass.GetUnqID, getClass.GetNumberOfStudents);
            getClass.Comment = "avoid eye contact";
            Console.WriteLine("\nClass: {0} \nNumber of students: {1}\nComment: {2}", getClass.GetUnqID, getClass.GetNumberOfStudents, getClass.Comment);

        }
예제 #28
0
        public void TestRemoveCourseWithNullValue()
        {
            List <Course> courses = new List <Course>()
            {
                new Course("HTML", this.students),
                new Course("CSS", this.students),
                new Course("C#", this.students),
                new Course("JS", this.students),
            };

            School.School tu = new School.School("TU", courses);
            tu.RemoveCourse(null);
        }
예제 #29
0
        public void TestRemoveCourseWithNullValue()
        {
            List<Course> courses = new List<Course>()
            {
                new Course("HTML", this.students),
                new Course("CSS", this.students),
                new Course("C#", this.students),
                new Course("JS", this.students),
            };

            School.School tu = new School.School("TU", courses);
            tu.RemoveCourse(null);
        }
예제 #30
0
        public void TestAddNullCourse()
        {
            List <Course> courses = new List <Course>()
            {
                new Course("HTML", this.students),
                new Course("CSS", this.students),
                new Course("C#", this.students),
                new Course("JS", this.students),
            };

            School.School tu = new School.School("TU", courses);
            tu.AddCourse(null);
        }
예제 #31
0
        public void TestRemoveCourse()
        {
            School.School s = new School.School("foo");
            Course c1 = new Course("Math");
            Course c2 = new Course("Biology");

            s.AddCourse(c1);
            s.AddCourse(c2);

            Course removed = s.RemoveCourse("Math");

            Assert.AreEqual(removed, c1);
        }
예제 #32
0
        public void TestRemoveCourse()
        {
            School.School s  = new School.School("foo");
            Course        c1 = new Course("Math");
            Course        c2 = new Course("Biology");

            s.AddCourse(c1);
            s.AddCourse(c2);

            Course removed = s.RemoveCourse("Math");

            Assert.AreEqual(removed, c1);
        }
        public void Course_AddingMoreThan29Students()
        {
            School mySchool = new School();
            Course art = new Course();

            for (int i = 1; i <= 35; i++)
            {
                Student student = new Student("Ivan Ivanov", i + 10000, mySchool);
                student.JoinCourse(art);
            }

            Assert.Fail("Course takes only 29 students");
        }
예제 #34
0
        public void TestRemoveCourseWithNonexistingCourse()
        {
            List<Course> courses = new List<Course>()
            {
                new Course("HTML", this.students),
                new Course("CSS", this.students),
                new Course("C#", this.students),
                new Course("JS", this.students),
            };

            School.School tu = new School.School("TU", courses);
            Course algo = new Course("Algorithms", students);
            tu.RemoveCourse(algo);
        }
        public void Course_LeavingCourse()
        {
            School mySchool = new School();
            Course art = new Course();

            for (int i = 1; i <= 15; i++)
            {
                Student student = new Student("Ivan Ivanov", i + 10000, mySchool);
                student.JoinCourse(art);
                student.LeaveCourse(art);
            }

            Assert.IsTrue(art.Members.Count == 0);
        }
예제 #36
0
        public void TestRemoveCourseWithNonexistingCourse()
        {
            List <Course> courses = new List <Course>()
            {
                new Course("HTML", this.students),
                new Course("CSS", this.students),
                new Course("C#", this.students),
                new Course("JS", this.students),
            };

            School.School tu   = new School.School("TU", courses);
            Course        algo = new Course("Algorithms", students);

            tu.RemoveCourse(algo);
        }
 public void CreatingSchoolWithOneCoursesShouldReturnOne()
 {
     var school = new School(
         "school",
         new List<Course>()
         {
             new Course(
                 "sss",
                 new List<Student>
                 {
                     new Student(
                         11111,
                         "ssss")
                 })
         });
     Assert.AreEqual(1, school.Courses.Count);
 }
예제 #38
0
        public void TestAddCourseWithValidCourse()
        {
            
            List<Course> courses = new List<Course>()
            {
                new Course("HTML", this.students),
                new Course("CSS", this.students),
                new Course("C#", this.students),
                new Course("JS", this.students),
            };

            School.School academy = new School.School("Telerik Academy", courses);
            var hqc = new Course("High Quality Code", students);
            academy.AddCourse(hqc);

            Assert.AreEqual(academy.Courses[4], hqc);
        }
예제 #39
0
        public void TestAddCourseWithValidCourse()
        {
            List <Course> courses = new List <Course>()
            {
                new Course("HTML", this.students),
                new Course("CSS", this.students),
                new Course("C#", this.students),
                new Course("JS", this.students),
            };

            School.School academy = new School.School("Telerik Academy", courses);
            var           hqc     = new Course("High Quality Code", students);

            academy.AddCourse(hqc);

            Assert.AreEqual(academy.Courses[4], hqc);
        }
예제 #40
0
        //a method for creating a new test school with predifined details
        //only the students are random picked ->check CreatArray method in Student class
        public static School New()
        {
            //create two student list with random details
            List<Student> exampleStudents1 = Student.CreateArray(10);
            List<Student> exampleStudents2 = Student.CreateArray(10);

            //create several disciplines with their names, lecture hours and exercies hours
            Discipline chemistry = new Discipline("Chemistry", 3, 3);
            Discipline history = new Discipline("History", 2, 2);
            Discipline mathematics = new Discipline("Mathematics", 4, 4);
            Discipline sport = new Discipline("Sport", 5, 5);

            //create list of disciplines for one of the teachers
            List<Discipline> exampleTeacher1Disciplines = new List<Discipline>();
            exampleTeacher1Disciplines.Add(chemistry);
            exampleTeacher1Disciplines.Add(mathematics);

            //create list of disciplines for the other teacher
            List<Discipline> exampleTeacher2Disciplines = new List<Discipline>();
            exampleTeacher2Disciplines.Add(history);
            exampleTeacher2Disciplines.Add(sport);

            //create two teachers and assign one list of disciplines to each of them
            Teacher exampleTeacher1 = new Teacher("Blagoy Stankov", exampleTeacher1Disciplines);
            Teacher exampleTeacher2 = new Teacher("Todor Trendafilov", exampleTeacher2Disciplines);

            //create a new class and add students and teacher to the class
            Class a12 = new Class("12a");
            a12.AddGroupStudents(exampleStudents1);
            a12.AddTeacher(exampleTeacher1);

            //create another class and add students and teacher to the class
            Class b12 = new Class("12b");
            b12.AddGroupStudents(exampleStudents2);
            b12.AddTeacher(exampleTeacher2);

            //create a new school
            School exampleSchool = new School("SOU Petko Rachov Slaveikov");

            //assign both classes to the school
            exampleSchool.AddClass(a12);
            exampleSchool.AddClass(b12);

            return exampleSchool;
        }
예제 #41
0
        public void TestRemoveCourseWithValidCourse()
        {
            List <Course> courses = new List <Course>()
            {
                new Course("HTML", this.students),
                new Course("CSS", this.students),
                new Course("C#", this.students),
                new Course("JS", this.students),
            };

            School.School tu = new School.School("TU", courses);
            Course        js = new Course("JS Part 2", students);

            tu.AddCourse(js);
            tu.RemoveCourse(js);

            Assert.IsFalse(tu.Courses.Contains(js));
        }
예제 #42
0
        public void TestRemoveCourseWithValidCourse()
        {  
            List<Course> courses = new List<Course>()
            {
                new Course("HTML", this.students),
                new Course("CSS", this.students),
                new Course("C#", this.students),
                new Course("JS", this.students),
            };

            School.School tu = new School.School("TU", courses);
            Course js = new Course("JS Part 2", students);
            
            tu.AddCourse(js);
            tu.RemoveCourse(js);

            Assert.IsFalse(tu.Courses.Contains(js));
        }
예제 #43
0
        public void TestRemoveMissingStudent()
        {
            School.School s  = new School.School("bar");
            Course        c  = new Course("Math");
            Course        c1 = new Course("alpha");
            Course        c2 = new Course("beta");

            s.AddCourse(c);
            s.AddCourse(c1);
            s.AddCourse(c2);

            Course removed = s.RemoveCourse("omega");
            bool   result  = removed == null;

            result = result && s.Courses[0] == c &&
                     s.Courses[1] == c1 && s.Courses[2] == c2;

            Assert.IsTrue(result);
        }
예제 #44
0
        public void TestAddFewCourses()
        {
            School.School s = new School.School("PMG");

            Course c1 = new Course("Math");
            Course c2 = new Course("Physics");
            Course c3 = new Course("Chemistry");

            s.AddCourse(c1);
            s.AddCourse(c2);
            s.AddCourse(c3);

            bool result = s.Courses.Count == 3;

            result = result && s.Courses[0].Name == c1.Name;
            result = result && s.Courses[1].Name == c2.Name;
            result = result && s.Courses[2].Name == c3.Name;

            Assert.IsTrue(result);
        }
예제 #45
0
 public void TestEmptyName()
 {
     School.School s = new School.School(string.Empty);
 }
예제 #46
0
 public void TestSchoolCreationWithEmptyNameShouldThrowException()
 {
     var testSchool = new School.School("");
 }
예제 #47
0
 public void TestSchoolCreationWithNullNameShouldThrowException()
 {
     var testSchool = new School.School(null);
 }
예제 #48
0
 public void TestNullName()
 {
     School.School s = new School.School(null);
 }
예제 #49
0
 public void TestTrivialSchoolCase()
 {
     School.School s = new School.School("SMG");
     Assert.AreEqual("SMG", s.Name);
 }
예제 #50
0
        static void Main(string[] args)
        {
            ///Create a Menu for the Front Page
            ///

            Console.WriteLine("...........................");

            Console.WriteLine("Welcome to the School");

            while (true)
            {
                Console.WriteLine("Select an option");
                Console.WriteLine("0. Exit");
                Console.WriteLine("1. New Student");
                Console.WriteLine("2. New Teacher");
                Console.WriteLine("3. Test Scores");
                Console.WriteLine("4. Leaves");
                Console.WriteLine("5. Print all Students");
                Console.WriteLine("6. Print all Teachers");

                var option = Console.ReadLine();

                switch (option)
                {
                case "0":
                    return;

                case "1":
                    Console.Write("Enter Students Name: ");
                    var name = Console.ReadLine();

                    Console.Write("Enter Grade: ");
                    var grade = Convert.ToInt32(Console.ReadLine());

                    Console.WriteLine("Select Transport: ");

                    var Trans = Enum.GetNames(typeof(TypeOfTransport));

                    for (int i = 0; i < Trans.Length; i++)
                    {
                        Console.WriteLine($"{i + 1}. {Trans[i]}");
                    }

                    Console.Write("Enter Transport Type: ");
                    var readLine = Console.ReadLine();
                    var number   = Convert.ToInt32(readLine);


                    var TransportType = Enum.Parse <TypeOfTransport>(Trans[number - 1]);

                    var student = School.CreateStudent(name, grade, TransportType);

                    Console.WriteLine($"Student Name: {student.StudentName}, Grade: {student.StudentGrade}, Transport: {student.Transport}, Student id {student.StudentId} ");



                    break;

                case "2":
                    Console.Write("Enter Teacher Name: ");
                    var Teachername = Console.ReadLine();

                    Console.Write("Enter Salary: ");
                    var salary = Convert.ToDecimal(Console.ReadLine());

                    var teacher = School.CreateTeacher(Teachername, salary);


                    Console.WriteLine($"Teacher Name: {teacher.TeacherName1}, Salary: {teacher.Salary}, Id:{teacher.TeacherId} ");
                    break;

                case "3":
                    Console.WriteLine("Please try again.Still working on this option.");
                    break;

                case "4":
                    Console.WriteLine("Please try again.Still working on this option.");

                case "5":
                {
                    var stud = School.GetStudents();

                    foreach (var s in stud)
                    {
                        Console.WriteLine($"Student Name: {s.StudentName}, Grade: {s.StudentGrade}, Transport: {s.Transport},Id: {s.StudentId}");
                    }
                    break;
                }

                case "6":
                {
                    var tea = School.GetTeachers();
                    foreach (var t in tea)
                    {
                        Console.WriteLine($"Teacher Name: {t.TeacherName1}, TeacherId:{t.TeacherId},Salary: {t.Salary}");
                    }
                }

                break;

                default:
                    break;
                }
            }
        }
예제 #51
0
 public void TestWhitespaceName()
 {
     School.School s = new School.School("  ");
 }
예제 #52
0
 public static void AddSchool(School school)
 {
     schools.Add(school);
 }