Example #1
0
        public void AddStudent(Student student)
        {
            if (this.students.Count > 30)
            {
                throw new InvalidOperationException("Students in a course cannot be more than 30");
            }

            foreach (var item in students)
            {
                if (item.Name == student.Name)
                {
                    throw new InvalidOperationException("Student is already attending course.");
                }
            }

            this.students.Add(student);
        }
Example #2
0
 public void IncorrectStudentName()
 {
     Student student = new Student("", 10000);
 }
Example #3
0
 public void IncorrectStudentID()
 {
     Student student = new Student("lol", 1);
     Assert.IsNotNull(student);
 }
Example #4
0
 public void CreateStudent()
 {
     Student student = new Student("lol", 10000);
     Assert.IsNotNull(student);
 }
Example #5
0
 public void CorrectStudentName()
 {
     Student student = new Student("lol", 10000);
     Assert.AreEqual("lol", student.Name);
 }
Example #6
0
 public void CorrectStudentID()
 {
     Student student = new Student("lol", 15000);
     Assert.AreEqual(15000, student.GetUID);
 }