Ejemplo n.º 1
0
        public void AddStudent_ThrowsExceptionWhenMaxReached()
        {
            Course course = new Course(".NET");

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

            for (int i = 0; i < 10; i++)
            {
                course.AddNewStudent(new Student("Student" + i));
            }
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 6
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("Ivan");
            bool notFound = !course.HasStudent("Ivannn");

            Assert.AreEqual(isFound, true);
            Assert.AreEqual(notFound, true);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 8
0
 public void RemoveStudent_ThrowsExceptionOnNotFound()
 {
     Course course = new Course(".NET");
     course.RemoveStudent(23);
 }
Ejemplo n.º 9
0
 public void Name_ThrowsExceptionWhenNull()
 {
     Course course = new Course(null);
 }