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); }
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); } }
public void StudentName_ThrowsExceptionWhenNull() { Student stud = new Student(null); }
public void StudentName_ThrowsExceptionWhenEmpty() { Student stud = new Student(""); }
public void AddStudent(Student stud) { if (!setOfStudents.Contains(stud)) setOfStudents.Add(stud); else { throw new ArgumentException("Student is already here"); } }
public void RemoveStudent(Student stud) { setOfStudents.Remove(stud); }
public void StudentID_ThrowsExceptionWhenIDTooSmall() { Student stud = new Student("Pesho"); stud.UniqueID = 1000; }