コード例 #1
0
        public void AddStudentMultipleTimeToCourseTest()
        {
            var school = new School();
            var studentIvan = school.RegisterStudent("Ivan");
            var csharpCourse = school.RegisterCourse("C# Part 2");

            school.AddStudentToCourse(studentIvan, csharpCourse);
            school.AddStudentToCourse(studentIvan, csharpCourse);
        }
コード例 #2
0
        static void Main()
        {
            var school = new School();

            var studentIvan = school.RegisterStudent("Ivan");
            Console.WriteLine(studentIvan);

            var studentPeter = school.RegisterStudent("Peter");
            Console.WriteLine(studentPeter);

            var csharpCourse = school.RegisterCourse("C# Fundamentals");
            school.AddStudentToCourse(studentIvan, csharpCourse);
            school.AddStudentToCourse(studentPeter, csharpCourse);

            Console.WriteLine(csharpCourse);
        }
コード例 #3
0
        public void AddNullStudentToCourseTest()
        {
            var school = new School();
            var csharpCourse = school.RegisterCourse("C# Part 2");

            school.AddStudentToCourse(null, csharpCourse);
        }
コード例 #4
0
        public void AddMissingStudentToCourseTest()
        {
            var school = new School();
            var studentIvan = school.RegisterStudent("Ivan");

            var school2 = new School();
            var csharpCourse = school2.RegisterCourse("C# Part 2");

            school2.AddStudentToCourse(studentIvan, csharpCourse);
        }
コード例 #5
0
        public void AddStudentToCourseUnderMaxCapacityTest()
        {
            var school = new School();
            var csharpCourse = school.RegisterCourse("C# Fundamentals");

            for (int i = 0; i < 31; i++)
            {
                var studentIvan = school.RegisterStudent(i.ToString());
                school.AddStudentToCourse(studentIvan, csharpCourse);
            }
        }
コード例 #6
0
        public void AddStudentToCourseTest()
        {
            var school = new School();
            var csharpCourse = school.RegisterCourse("C# Fundamentals");
            var studentIvan = school.RegisterStudent("Ivan");

            school.AddStudentToCourse(studentIvan, csharpCourse);

            Assert.AreEqual(1, csharpCourse.Students.Count);
        }
コード例 #7
0
        public void RemoveStudentFromCourseTest()
        {
            var school = new School();
            var studentIvan = school.RegisterStudent("Ivan");
            var csharpCourse = school.RegisterCourse("C# Part 2");

            school.AddStudentToCourse(studentIvan, csharpCourse);
            school.RemoveStudentFromCourse(studentIvan, csharpCourse);
        }
コード例 #8
0
        public void Add_100_000_StudentsToCourseTest()
        {
            var school = new School();
            var csharpCourse = school.RegisterCourse("C# Part 2");

            for (int i = 0; i < 100001; i++)
            {
                var studentIvan = school.RegisterStudent("Ivan");
                school.AddStudentToCourse(studentIvan, csharpCourse);

                if (csharpCourse.Students.Count == csharpCourse.StudentsCapacity - 1)
                {
                    csharpCourse = school.RegisterCourse(i.ToString()); // Random name
                }
            }
        }