Beispiel #1
0
        public void GetFullCourseStudentInfo()
        {
            Student pesho = new Student("Pepito", 10101);
            Student gosho = new Student("Gosho", 10201);
            Course pottary = new Course("Pottary");

            testingSchool.AddStudent(pesho);
            testingSchool.AddStudent(gosho);
            testingSchool.AddCourse(pottary);
            testingSchool.AddStudentToCourse(pesho, pottary);
            testingSchool.AddStudentToCourse(gosho, pottary);

            StringBuilder actualResult = new StringBuilder();
            actualResult.AppendLine(pesho.DisplayFullCourseInfoToConsoleAndReturnValue());

            StringBuilder expectedResult = new StringBuilder();
            expectedResult.AppendLine("Pepito is attending:");
            expectedResult.AppendFormat("Course name: Pottary");
            expectedResult.AppendLine();
            expectedResult.AppendLine("The students appending this course are:");
            foreach (Course course in pesho.AttendedCourse)
            {
                expectedResult.AppendLine(course.GetFullInfo());
            }

            Assert.AreEqual(expectedResult, expectedResult);
        }