public void AddStudent_ThrowsExceptionWhenMaxReached()
        {
            Course course = new Course(".NET");

            for (int i = 0; i < Course.MaxStudentCount + 1; i++)
            {
                course.AddNewStudent(new Student("Student" + i));
            }
        }
        public void AddStudent_ExecutesCorrectlyWith10Students()
        {
            Course course = new Course(".NET");

            for (int i = 0; i < 10; i++)
            {
                course.AddNewStudent(new Student("Student" + i));
            }
        }
        public void RemoveStudent_ExecutesCorrectlyOnRemove()
        {
            Course course = new Course(".NET");

            for (int i = 0; i < 10; i++)
            {
                course.AddNewStudent(new Student("Student" + i));
            }

            course.RemoveStudent(Student.NextID - 5);
        }
        public void StudentID_HasCorrectValue()
        {
            Course course = new Course(".NET");

            for (int i = 0; i < 5; i++)
            {
                course.AddNewStudent(new Student("Student" + i));
            }

            int lastStudentID = course.Students[4].UniqueID;

            Assert.AreEqual(Student.NextID - 1, lastStudentID);
        }
Exemple #5
0
        public void AddCourse(Course newCourse)
        {
            if (newCourse == null)
                throw new ArgumentException("Course cannot be null!");

            foreach (Course course in courses)
            {
                if (course.Name == newCourse.Name)
                    throw new InvalidOperationException("This course is already registered in the school!");
            }

            this.courses.Add(newCourse);
        }
        public void HasStudent_Test()
        {
            Course course = new Course(".NET");

            course.AddNewStudent(new Student("Pesho"));
            course.AddNewStudent(new Student("Ivan"));
            course.AddNewStudent(new Student("Garo"));

            bool isFound = course.HasStudent("Ivan");
            bool notFound = !course.HasStudent("Ivannn");

            Assert.AreEqual(isFound, true);
            Assert.AreEqual(notFound, true);
        }
Exemple #7
0
        public void HasStudent_Test()
        {
            Course course = new Course(".NET");

            course.AddNewStudent(new Student("Pesho"));
            course.AddNewStudent(new Student("Ivan"));
            course.AddNewStudent(new Student("Garo"));

            bool isFound = course.HasStudent(Student.NextID - 2);
            bool notFound = !course.HasStudent(Student.NextID - 4);

            Assert.AreEqual(true, isFound);
            Assert.AreEqual(true, notFound);
        }
 public void RemoveStudent_ThrowsExceptionOnNotFound()
 {
     Course course = new Course(".NET");
     course.RemoveStudent(23);
 }
 public void Name_ThrowsExceptionWhenNull()
 {
     Course course = new Course(null);
 }