コード例 #1
0
 public void AddStudentToCourseTwiceTest()
 {
     Course sampleCourse = new Course("Javascript");
     Student ivan = new Student(10000, "Ivan Ivanov");
     sampleCourse.AddStudent(ivan);
     sampleCourse.AddStudent(ivan);
     Assert.Fail();
 }
コード例 #2
0
 public void RemoveStudentThatIsNotEnrolledTest()
 {
     Student ivan = new Student(10000, "Ivan Ivanov");
     Student pesho = new Student(10001, "Pesho Peshov");
     Course sampleCourse = new Course("Javascript");
     sampleCourse.AddStudent(ivan);
     sampleCourse.RemoveStudent(pesho);
     Assert.Fail();
 }
コード例 #3
0
 public void AddStudentToFullCourseTest()
 {
     Course sampleCourse = new Course("Javascript");
     for (int i = 0; i < 31; i++)
     {
         sampleCourse.AddStudent(new Student(10000 + i, "Ivan Ivanov"));
     }
     Assert.Fail();
 }
コード例 #4
0
 public void CourseWithOneStudentTest()
 {
     Student ivan = new Student(10000, "Ivan Ivanov");
     Course sampleCourse = new Course("Javascript");
     sampleCourse.AddStudent(ivan);
     Student[] enrolledStudents = sampleCourse.GetStudents();
     Assert.IsTrue(sampleCourse.CourseName == "Javascript");
     Assert.IsTrue(enrolledStudents.Length == 1);
     Assert.IsTrue(enrolledStudents[0] == ivan);
 }
コード例 #5
0
 public void RemoveStudentFromCourseTest()
 {
     Student ivan = new Student(10000, "Ivan Ivanov");
     Course sampleCourse = new Course("Javascript");
     sampleCourse.AddStudent(ivan);
     Student[] enrolledStudents = sampleCourse.GetStudents();
     Assert.IsTrue(enrolledStudents.Length == 1);
     sampleCourse.RemoveStudent(ivan);
     Student[] enrolledStudentsWithoutStudent = sampleCourse.GetStudents();
     Assert.IsTrue(enrolledStudentsWithoutStudent.Length == 0);
 }
コード例 #6
0
        public void DisplayEnrolledStudents()
        {
            Student ivan = new Student(10000, "Ivan Ivanov");
            Course sampleCourse = new Course("Javascript");
            sampleCourse.AddStudent(ivan);
            string courseString = sampleCourse.ToString();
            
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("Course name: Javascript");
            sb.AppendLine("ID: 10000, Name: Ivan Ivanov");
            string expectedString = sb.ToString();

            Assert.AreEqual(expectedString, courseString);
        }