AddStudent() 공개 메소드

public AddStudent ( Student newStudent ) : void
newStudent Student
리턴 void
 public void AddStudentTwiseTest()
 {
     Course course = new Course("Math");
     Student student = new Student("Gosho", "Ivanov", 12345);
     course.AddStudent(student);
     course.AddStudent(student);
 }
예제 #2
0
 public void AddingTheSameStudentMoreThanOnce_ThrowException()
 {
     var spirt = new Course("Spirt");
     var student = new Student("Peter");
     spirt.AddStudent(student);
     spirt.AddStudent(student);
 }
예제 #3
0
 public void RemoveStudentInCourse()
 {
     Course course = new Course("lala");
     course.AddStudent(new Student("lol", 10000));
     course.RemoveStudentByUID(10000);
     course.AddStudent(new Student("lol", 10000));
 }
예제 #4
0
        private static void Main()
        {
            try
            {
                Student pesho = new Student("Pesho Georgiev");
                Student gosho = new Student("Gosho Ivanov");
                Student misho = new Student("Misho Cekov");
                Student sasho = new Student("Sasho Kostov");

                Course telerikAcademy = new Course("Telerik Academy");
                Course webProgramming = new Course("Web Programming");

                webProgramming.AddStudent(sasho);

                telerikAcademy.AddStudent(pesho);
                telerikAcademy.AddStudent(gosho);
                telerikAcademy.AddStudent(misho);

                telerikAcademy.RemoveStudent(gosho);
                Console.WriteLine(gosho.ToString() + " was removed from course.");

                Console.WriteLine("Courses:");
                Console.WriteLine(telerikAcademy);

                School freeSchool = new School("School of Computer Sciences");
                freeSchool.AddCourse(webProgramming);
                freeSchool.AddCourse(telerikAcademy);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
예제 #5
0
        static void Main(string[] args)
        {
            List <Course> courses = new List <Course>();

            //initialize student classes
            Student Mike   = new Student("Mike", 254377, 18);
            Student Nicole = new Student("Nicole", 331988, 18);
            Student Samara = new Student("Samara", 229916, 18);
            Student Cezar  = new Student("Cezar", 492151, 18);
            Student Senada = new Student("Senada", 737321, 18);

            //initialize courses
            Course Bio  = new Course("Biology", "Mr. Franklin");
            Course Chem = new Course("Chemistry", "Mr. Dettloff");

            //add courses to course list
            courses.Add(Bio);
            courses.Add(Chem);

            //add students to courses
            Bio.AddStudent(Mike);
            Bio.AddStudent(Cezar);
            Bio.AddStudent(Senada);
            Chem.AddStudent(Nicole);
            Chem.AddStudent(Samara);


            foreach (Course course in courses)
            {
                Console.WriteLine("\nCourse: {0}\nInstructor: {1}", course.CourseTitle, course.Instructor);
                course.PrintStudents();
            }

            Console.ReadLine();
        }
예제 #6
0
        public void CourseCanNotContainAStudentMoreThanOnce()
        {
            var course = new Course("math");
            var student = new Student("Pesho", 12345);

            course.AddStudent(student);
            course.AddStudent(student);
        }
예제 #7
0
        public void CourseAddingAnAlreadyExistingStudentShouldThrow()
        {
            var course = new Course("Just a course");
            var student = new Student("Captain Nemo", 12000);

            course.AddStudent(student);
            course.AddStudent(student);
        }
예제 #8
0
 public void TestAddStudentException()
 {
     Course html = new Course("HTML", students);
     Student pesho = new Student("Peter", 29345);
     Student gosho = new Student("Georgi", 99922);
     html.AddStudent(pesho);
     html.AddStudent(gosho);
 }
예제 #9
0
 public void TestAddStudent2()
 {
     Course course = new Course("Telerik Academy");
     Student misho = new Student("Misho Ivanov");
     Student pesho = new Student("Pesho Ivanov");
     pesho.Number = misho.Number;
     course.AddStudent(misho);
     course.AddStudent(pesho);
 }
예제 #10
0
 public void TestAddStudent4()
 {
     Course course = new Course("Telerik Academy");
     Student misho = new Student("Misho Ivanov");
     Student pesho = new Student("Pesho Ivanov");
     course.AddStudent(misho);
     course.AddStudent(pesho);
     Assert.IsTrue(course.ListOfStudents.Count == 2);
 }
예제 #11
0
        public void AddingOneStudentTwiceShouldMakeCourseHaveOnlyOneStudent()
        {
            var student = new Student("Pesho");
            var course = new Course();

            course.AddStudent(student);
            course.AddStudent(student);

            Assert.AreEqual(1, course.StudentsCount);
        }
예제 #12
0
        public void CourseAddingMoreThanThirtyStudentsShouldThrow()
        {
            var course = new Course("1337 sP33cH Course");
            for (int i = 0; i < 30; i++)
            {
                course.AddStudent(new Student(string.Format("Robot P" + i + "esho" + i), 13337 + i));
            }

            course.AddStudent(new Student("Cptn Nemo", 10001));
        }
예제 #13
0
 public void CourseToStringTest()
 {
     var course = new Course("C# HQC");
     var pesho = new Student("Pesho", 10132);
     var gosho = new Student("Gosho", 10123);
     course.AddStudent(pesho);
     course.AddStudent(gosho);
     string expected = "Course name: C# HQC\nStudent name is: Pesho, with id: 10132\nStudent name is: Gosho, with id: 10123\n";
     string actual = course.ToString();
     Assert.AreEqual(expected, actual);
 }
예제 #14
0
        public void Test_CourseAddStudentsWithNotUniqueNumberShouldThrow()
        {
            var firstName = "Jhon";
            var lastName = "Minkov";
            var studentNumber = 19999;

            var student = new Student(firstName, lastName, studentNumber);
            var course = new Course("CSharp");
            course.AddStudent(student);
            var invalidStudent = new Student("Ivo", "Kenov", 19999);
            course.AddStudent(invalidStudent);
        }
예제 #15
0
 public void CourseRemoveStudentTest()
 {
     var course = new Course("Javascript");
     var pesho = new Student("Pesho", 10131);
     var gosho = new Student("Gosho", 10132);
     course.AddStudent(pesho);
     course.AddStudent(gosho);
     course.RemoveStudent(gosho);
     var actual = course.ToString();
     var expected = "Course name: Javascript\nStudent name is: Pesho, with id: 10131\n";
     Assert.AreEqual(expected, actual);
 }
예제 #16
0
        public void AddExistingStudentToCourse()
        {
            Course math = new Course("Math");
            testingSchool.AddCourse(math);
            testingCourses.Add(math);

            this.testingStudents.Add(new Student("Pesho", 10000));

            testingStudents[0].AddCourse(math);
            math.AddStudent(testingStudents[0]);
            math.AddStudent(testingStudents[0]);
        }
예제 #17
0
 public void AddStudentInFullClassTest()
 {
     Course course = new Course("Math");
     string firstName = "Test";
     string lastName = "Testov";
     for (int i = 0; i < 30; i++)
     {
         course.AddStudent(new Student(firstName, lastName, 10000 + i));
     }
     Student student = new Student("Gosho", "Ivanov", 12345);
     course.AddStudent(student);
 }
예제 #18
0
        public void AddStudentTestThirtyOneStudents()
        {
            List<Student> studentList = new List<Student>();
            Course courseThirtyOneStudents = new Course(studentList);
            for (int i = 0; i < 30; i++)
            {
                courseThirtyOneStudents.AddStudent(new Student("Pesho", 10000 + i));
            }

            Student studentPesho = new Student("Pesho", 10031);
            courseThirtyOneStudents.AddStudent(studentPesho);
        }
예제 #19
0
        public void TestUniqueIndentifier()
        {
            Course c = new Course("C# programming");
            Student s1 = new Student("Niki", 12345);
            Student s2 = new Student("Doncho", 12346);
            Student s3 = new Student("George", 12347);
            Student s4 = new Student("Svetlin", 12347);

            c.AddStudent(s1);
            c.AddStudent(s2);
            c.AddStudent(s3);
            c.AddStudent(s4);
        }
예제 #20
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome back to School!");
            Console.WriteLine();

            Student josh = new Student("Josh");
            Student matt = new Student("Matt");
            Student zak  = new Student("Zak");

            Course csharp = new Course(4, "csharp");
            Course python = new Course(3, "python");

            csharp.AddStudent(josh);
            python.AddStudent(matt);
            python.AddStudent(zak);
            python.AddStudent(zak);

            josh.AddGrade(4, 4);
            josh.AddGrade(3, 4);
            matt.AddGrade(3, 3);
            zak.AddGrade(3, 4);

            Console.WriteLine(josh);
            Console.WriteLine();

            Console.WriteLine(matt);
            Console.WriteLine();

            Console.WriteLine(zak);
            Console.WriteLine();

            Console.WriteLine(python.ToString());
            Console.WriteLine(csharp.ToString());

            Console.ReadLine();

            //static void WriteResult(string name, double gpa)
            //{
            //    Console.WriteLine($"{name}: {gpa}", name, gpa);
            //    Console.ReadLine();
            //}

            //static void WriteResult(DateTime dateTime)
            //{
            //    Console.WriteLine(dateTime);
            //    Console.ReadLine();
            //}
        }
예제 #21
0
        static void Main(string[] args)
        {
            Course math = new Course("Math");
            for (int i = 0; i < 30; i++)
            {
               math.AddStudent(new Student("Test Student : " + i));
            }

            Console.WriteLine(math);

            math.RemoveStudentByID(10000);
            math.RemoveStudentByID(10001);
            math.RemoveStudentByID(10002);

            Console.WriteLine(math);

            //throw exception
            //math.RemoveStudentByID(9);

            SchoolDem PMG = new SchoolDem("PMG");
            PMG.AddCourse(math);

            //throwing exceptions
            //PMG.AddCourse(math);
            //PMG.AddCourse(null);
            Console.WriteLine(PMG);

            var school = new SchoolDem("Banichka");
            var course = new Course("Alg");

            school.AddCourse(course);

            Console.WriteLine(school);
        }
예제 #22
0
 public void AddStudentAtsCourseMethodTest()
 {
     Course course = new Course("Math");
     Student student = new Student("Gosho", "Ivanov", 12345);
     course.AddStudent(student);
     Assert.AreEqual(student.ID, course.ListOfStudents[0].ID);
 }
예제 #23
0
        static void Main(string[] args)
        {
            Student        Taemin   = new Student("Taemin");
            Student        Onew     = new Student("Onew");
            List <Student> students = new List <Student>()
            {
                Taemin
            };
            Course SHINee = new Course("SHINee", "Lee Soo Man", students);

            SHINee.AddStudent(Onew);

            Console.WriteLine(SHINee.Name);
            Console.WriteLine(SHINee.Professor);

            Taemin.AddGrade(5, 100);
            Taemin.AddGrade(5, 90);
            Console.WriteLine(Taemin.GetGradeLevel());
            //Console.WriteLine(Taemin.Gpa); //set to private

            Console.WriteLine(Taemin); //Taemin (Credits: 10, GPA: 95)

            Onew.AddGrade(3, 80);

            Console.WriteLine(SHINee);
            Console.WriteLine(Taemin.Equals(Taemin));
            Console.WriteLine(Taemin.Equals(Onew));
        }
예제 #24
0
        public static void Main()
        {
            Course cSharp = new Course("C#");
            Student pesho = new Student("Pesho Peshev", 12345);
            Student gosho = new Student("Gosho Goshev", 13451);

            cSharp.AddStudent(pesho);
            cSharp.AddStudent(gosho);

            Course javaScript = new Course("JavaScript");
            javaScript.AddStudent(pesho);
            javaScript.AddStudent(gosho);

            Student vankata = new Student("Vankata Vankov", 13124);
            javaScript.AddStudent(vankata);
        }
예제 #25
0
        public void CourseRemovingInvalidStudentShouldThrow()
        {
            var course = new Course("course");
            Student student = null;

            course.AddStudent(new Student("Captain Nemo", 12000));
            course.RemoveStudent(student);
        }
예제 #26
0
        public void CourseRemovingAStudentWhoHasntEnrolledInTheCourseShouldThrow()
        {
            var course = new Course("course");
            var student = new Student("Captain Blackbeard", 10000);

            course.AddStudent(student);
            course.RemoveStudent(new Student("Captain Nemo", 12000));
        }
예제 #27
0
 public void MoreThan30Students()
 {
     Course course = new Course("lala");
     for (int i = 0; i < 35; i++)
     {
         course.AddStudent(new Student(i.ToString(), 10000 + i));
     }
 }
예제 #28
0
        public void CourseShouldAddStudentCorrectly()
        {
            var course = new Course("Intermediate Pirate Speech");
            var student = new Student("Captain Blackbeard", 55764);
            course.AddStudent(student);

            Assert.IsTrue(course.Students.Any(stud => stud.Name == student.Name && stud.Id == student.Id));
        }
예제 #29
0
 public void CourseCanNotContain30OrMoreStudents()
 {
     var course = new Course("math");
     for (int i = 0; i < 30; i++)
     {
         course.AddStudent(new Student(i.ToString(), 10000 + i));
     }
 }
예제 #30
0
 public void TestMaxStudents()
 {
     Course c = new Course("Math");
     for (int i = 0; i <= 30; i++)
     {
         c.AddStudent(new Student("Johny", 20000 + i));
     }
 }
예제 #31
0
 public void AddStudentTestOneStudent()
 {
     List<Student> studentList = new List<Student>();
     Course courseOneStudent = new Course(studentList);
     Student studentPesho = new Student("Pesho", 10000);
     courseOneStudent.AddStudent(studentPesho);
     Assert.IsTrue(Course.students.Count == 1);
 }
예제 #32
0
 public void CourseOverflowTest()
 {
     var course = new Course("C# HQC");
     for (int i = 10100; i < 10135; i++)
     {
         course.AddStudent(new Student("Pesho", i));
     }
 }
예제 #33
0
        public void TestAddStudent3()
        {
            Course course = new Course("Telerik Academy");
            Student misho = new Student("Misho Ivanov");
            course.AddStudent(misho);

            Assert.AreEqual(1, course.ListOfStudents.Count, "Student was not added successfully.");
        }
        public void AttendCourse(Course course)
        {
            if (course == null)
            {
                throw new ArgumentNullException("course", "Course cannot be null.");
            }

            course.AddStudent(this);
        }
예제 #35
0
        public void JoinCourse(Course course)
        {
            if (course == null)
            {
                throw new ArgumentNullException("Course can not be null");
            }

            course.AddStudent(this);
        }
예제 #36
0
        public void JoinCourse(Course course)
        {
            if (course == null)
            {
                throw new NullReferenceException("Course cannot be null");
            }

            course.AddStudent(this);
        }
예제 #37
0
        public void JoinCourse(Course course)
        {
            if (course == null)
            {
                throw new ArgumentNullException("The course for adding a student should not be null");
            }

            course.AddStudent(this);
        }
예제 #38
0
        public void EnrollCourse(Course course)
        {
            if (course == null)
            {
                throw new ArgumentException("Course can not be null.");
            }

            course.AddStudent(this);
        }
예제 #39
0
        public void SignCourse(Course course)
        {
            if (course == null)
            {
                throw new ArgumentNullException("Course cannot be null");
            }

            this.courses.Add(course);
            if (!course.Students.Contains(this))
            {
                course.AddStudent(this);
            }
        }
예제 #40
0
        public void AttendCourse(Course course)
        {
            if (course == null)
            {
                throw new ArgumentNullException("course", "Course cannot be null.");
            }

            if (course.Students.Count >= maxStudents)
            {
                throw new InvalidOperationException("Students list is full");
            }
            course.AddStudent(this);
        }
예제 #41
0
파일: Program.cs 프로젝트: ruuhuu/school
        static void Main(string[] args)
        {
            bool keepRunning = true;

            Course course = new Course();

            course.Name = "Software Engineering";
            course.Room = "OIL1.60";

            while (keepRunning)
            {
                Console.WriteLine("What is the first name?");
                string firstName = Console.ReadLine();
                Console.WriteLine("What is the last name?");
                string LastName = Console.ReadLine();

                Student student = new Student();
                student.FirstName = firstName;
                student.LastName  = LastName;

                course.AddStudent(student);

                Console.WriteLine();
                Console.WriteLine("======================================");
                Console.WriteLine($"For course with name {course.Name} in room {course.Room} the following students have signed up:");
                foreach (Student studentInList in course.Students)
                {
                    Console.WriteLine(studentInList.FirstName + " " + studentInList.LastName);
                }
                Console.WriteLine("======================================");
                Console.WriteLine();
            }
            // ZELF VERDER ONDERZOEKEN:
            // Properties
            // Encapsulation
            // Constructor
        }
예제 #42
0
 public bool JoinCourse(Course course)
 {
     course.AddStudent(this);
     return(true);
 }
예제 #43
0
        public void JoinCourse(Course course)
        {
            Validator.CheckIfNull(course, "Course to join");

            course.AddStudent(this);
        }
예제 #44
0
 public void JoinCourse(Course course)
 {
     course.AddStudent(this);
 }