Ejemplo n.º 1
0
        public void AddNewStudent(Student student)
        {
            if (student == null)
                throw new ArgumentException("Value should not be null!");

            if (this.students.Count == MaxStudentCount || this.HasStudent(student.Name))
                throw new InvalidOperationException("Max students count reached or student already enrolled!");

            this.students.Add(student);
        }
Ejemplo n.º 2
0
 public Class(string uniqueClassID, Teacher[] teachers, Student[] students)
 {
     this.utid = uniqueClassID;
     setOfTeachers = new List<Teacher>();
     setOfStudents = new List<Student>();
     foreach (var item in teachers)
     {
         this.AddTeacher(item);
     }
     foreach (var item in students)
     {
         this.AddStudent(item);
     }
 }
Ejemplo n.º 3
0
 public void StudentName_ThrowsExceptionWhenNull()
 {
     Student stud = new Student(null);
 }
Ejemplo n.º 4
0
 public void StudentName_ThrowsExceptionWhenEmpty()
 {
     Student stud = new Student("");
 }
Ejemplo n.º 5
0
 public void AddStudent(Student stud)
 {
     if (!setOfStudents.Contains(stud))
         setOfStudents.Add(stud);
     else
     {
         throw new ArgumentException("Student is already here");
     }
 }
Ejemplo n.º 6
0
 public void RemoveStudent(Student stud)
 {
     setOfStudents.Remove(stud);
 }
Ejemplo n.º 7
0
 public void StudentID_ThrowsExceptionWhenIDTooSmall()
 {
     Student stud = new Student("Pesho");
     stud.UniqueID = 1000;
 }