public void AddStudentToCourseTwiceTest() { Course sampleCourse = new Course("Javascript"); Student ivan = new Student(10000, "Ivan Ivanov"); sampleCourse.AddStudent(ivan); sampleCourse.AddStudent(ivan); Assert.Fail(); }
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(); }
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(); }
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); }
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); }
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); }