Exemplo n.º 1
0
        public void StudentShouldSubscribeToCourseOnlyOnce()
        {
            var student = new Student("Pesho");
            var course = new Course("Math");
            course.Subscribe(student);
            course.Subscribe(student);
            course.Subscribe(student);

            Assert.AreEqual(course.Students.Count, 1);
        }
Exemplo n.º 2
0
        public void AddingCourseToStudent_ShouldPass()
        {
            var student = new Student("Pesho");
            var course = new Course("Math");
            course.Subscribe(student);

            Assert.AreEqual(course.Students.Count, 1);
        }
Exemplo n.º 3
0
        public void UnsibscribingStudentFromCourse_ShouldPass(string name)
        {
            var course = new Course("Math");
            var student = new Student(name);
            course.Subscribe(student);
            course.Unsubscribe(student);

            Assert.AreEqual(course.Students.Count, 0);
        }
Exemplo n.º 4
0
        public void AddingMultipleStudentsToCourse()
        {
            var course = new Course("Biology");

            for (int i = 0; i < 35; i++)
            {
                var student = new Student(i.ToString());
                course.Subscribe(student);
            }

            Assert.AreEqual(course.Students.Count, Constants.MAX_STUDENTS_IN_COURSE);
        }
Exemplo n.º 5
0
        public void UnsubscribingNotSubscribedStudent_ShouldDoNothing()
        {
            var course = new Course("Math");
            var student = new Student("Pesho");
            var pesho = new Student("Pesho");
            course.Subscribe(student);
            course.Unsubscribe(pesho);

            Assert.AreEqual(course.Students.Count, 1);
        }