Exemple #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);
        }
 public void IncorrectStudentName()
 {
     Student student = new Student("", 10000);
 }
 public void IncorrectStudentID()
 {
     Student student = new Student("lol", 1);
     Assert.IsNotNull(student);
 }
 public void CreateStudent()
 {
     Student student = new Student("lol", 10000);
     Assert.IsNotNull(student);
 }
 public void CorrectStudentName()
 {
     Student student = new Student("lol", 10000);
     Assert.AreEqual("lol", student.Name);
 }
 public void CorrectStudentID()
 {
     Student student = new Student("lol", 15000);
     Assert.AreEqual(15000, student.GetUID);
 }