public void CourseToStringNoStudentsTest()
 {
     Course course = new Course("HQPC");
     string expected = "Course: HQPC";
     string result = course.ToString();
     Assert.AreEqual(expected, result);
 }
        public void CourseToStringWithStudentsTest()
        {
            IList<Student> students = new List<Student> {
                new Student("Pesho Peshov", 11011),
                new Student("Gosho Goshov", 11001)
            };

            Course course = new Course("HQPC", students);
            string expected = "Course: HQPC\nStudents:\n11011: Pesho Peshov\n11001: Gosho Goshov";
            string result = course.ToString();
            Assert.AreEqual(expected, result);
        }
Example #3
0
        public void TestToString()
        {
            Course course = new Course("Chemistry");
            course.AddStudent(new Student("Hari", 125));

            string expectedOutput = "Course name: Chemistry" + Environment.NewLine +
                "Student: Hari, number: 125.";
            Assert.AreEqual(expectedOutput, course.ToString());
        }