static void Main() { School newSchool = new School("SMG"); //Console.WriteLine(newSchool.Name); List<Student> newStudentsList = new List<Student> { new Student("Ivo Ivanov", 1), new Student("Lina Nikolova", 2), new Student("Miglena Ivanov", 3), }; List<Teacher> newTeachersList = new List<Teacher> { new Teacher("Ivan Mishov"), new Teacher("Pesho Pesho") }; ClassOfStudents classA = new ClassOfStudents("Class A", newTeachersList, newStudentsList); //Console.WriteLine(classA); newSchool.AddClass(classA); //Console.WriteLine(newSchool); newSchool.RemoveClass(classA); //Console.WriteLine(newSchool); classA.MakeComment = "Bla bla"; //Console.WriteLine(classA.MakeComment); Student newStudent = new Student("Ani", 4); classA.AddStudent(newStudent); //Console.WriteLine(classA); classA.RemoveStudent(newStudent); //Console.WriteLine(classA); //Console.WriteLine(newStudent); newStudent.MakeComment = "AlA bala"; //Console.WriteLine(newStudent.MakeComment); Discipline newDiscipline = new Discipline("Math", 3, 5); Teacher newTeacher = new Teacher("Ivan Dragnev"); newTeacher.AddDiscipline(newDiscipline); //Console.WriteLine(newTeacher); newTeacher.RemoveDiscipline(newDiscipline); //Console.WriteLine(newTeacher); Student studentIvo = new Student("Ivo", 12); Console.WriteLine(studentIvo.Name); }
public void AddStudent(Student student) { if (student == null) { throw new ArgumentNullException("Student cannot be null!"); } if (this.students.Count >= MaxNumberOfStudentsInCourse) { throw new ArgumentOutOfRangeException("Student cannot be added! Students in course cannot be more than " + MaxNumberOfStudentsInCourse); } this.students.Add(student); }
public void AddStudent(string firstName, string lastName, int fn) { if (fn < MinStudentNumber || fn > MaxStudentNumber) { throw new ArgumentOutOfRangeException(string.Format("Faculty number must be between {0} and {1}.", MinStudentNumber, MaxStudentNumber)); } if (this.students.Count != 0) { foreach (var student in this.students) { if (student.FN == fn) { throw new ArgumentException("The faculty number must be unique! Try with new fn."); } } } Student studentToAdd = new Student(firstName, lastName, fn); students.Add(studentToAdd); }
public void FacultyNumberShouldBeCorrectlyInitialized() { Student student = new Student("Kiro", "Kirov", -1); }
public void LastNameShouldNotBeNull() { Student student = new Student("Kiro", "", 12345); }
public void FirstNameShouldNotBeNull() { Student student = new Student("", "Kirov", 12345); }
public void RemoveStudent(Student studentDeleted) { this.studentsList.Remove(studentDeleted); }
public void AddStudent(Student newStudent) { this.studentsList.Add(newStudent); }