Exemplo n.º 1
0
        public void CourseTestRemoveExistentStudent()
        {
            var student = new Student("Ivan Ivanov", 12300);
            var course = new Course("CMS");

            course.AddStudent(student);
            course.RemoveStudent(student);
        }
Exemplo n.º 2
0
 public void CourseTestRemove()
 {
     var student = new Student("Ivan Ivanov", 12300);
     var student1 = new Student("Petkan Ivanov", 12100);
     var course = new Course("Csharp");
     course.AddStudent(student);
     course.RemoveStudent(student1);
 }
Exemplo n.º 3
0
        public void OneStudentInCourseLeaves()
        {
            List<Student> students = new List<Student>();
            students.Add(new Student("Petko", 12987));

            Course course = new Course();

            course.RemoveStudent(students[0]);
        }
Exemplo n.º 4
0
        public void CourseRemoveStudentFromCourseTest()
        {
            string name = "C# Course";
            Student iliqn = new Student("Iliqn Dimitrov", 21475);
            Course cSharpCourse = new Course(name);
            cSharpCourse.AddStudent(iliqn);
            cSharpCourse.RemoveStudent(iliqn);

            Assert.AreEqual(0, cSharpCourse.CountOfStudents());
        }
Exemplo n.º 5
0
 public void CourseRemoveStudentNullTest()
 {
     Course course = new Course("HQPC");
     course.RemoveStudent(null);
 }
Exemplo n.º 6
0
 public void CourseRemoveStudentNonExistingStudentTest()
 {
     Course course = new Course("HQPC");
     Student student = new Student("Pesho Peshov", 11011);
     course.RemoveStudent(student);
 }
Exemplo n.º 7
0
        public void CourseRemoveStudentExistingStudentTest()
        {
            Student student = new Student("Pesho Peshov", 11011);
            IList<Student> students = new List<Student> {
                student,
                new Student("Gosho Goshov", 11001)
            };

            Course course = new Course("HQPC", students);
            course.RemoveStudent(student);

            int expectedStudentsCount = 1;
            int resultStudentsCount = course.Students.Count;
            string expectedStudent = "11001: Gosho Goshov";
            string resultStudent = course.Students[0].ToString();

            Assert.AreEqual(expectedStudentsCount, resultStudentsCount, "Removing students from course works incorrectly.");
            Assert.AreEqual(expectedStudent, resultStudent, "Removing students from course works incorrectly.");
            // I know I should only assert one thing in a test but these practically test the same thing in a different way
        }
Exemplo n.º 8
0
        public void TestRemoveNonExistentStudent()
        {
            Course course = new Course("Chemistry");
            course.AddStudent(new Student("Hari", 125));

            course.RemoveStudent(new Student("Joe", 111));
        }
Exemplo n.º 9
0
 public void TestRemoveStudentNullObject()
 {
     Course course = new Course("Chemistry");
     course.RemoveStudent(null);
 }
Exemplo n.º 10
0
        public void TestRemoveStudentNormalRemoval()
        {
            Course course = new Course("Chemistry");
            course.AddStudent(new Student("Hari", 125));

            course.RemoveStudent(new Student("Hari", 125));
        }
Exemplo n.º 11
0
 public void RemoveStudent_RemoveUnsignedStudent()
 {
     Course course = new Course("OS", 123);
     course.RemoveStudent(new Student(1000, "Gosho"));
 }
Exemplo n.º 12
0
 public void RemoveStudent_RemoveStudentNull()
 {
     Course course = new Course("OS", 123);
     course.RemoveStudent(null);
 }
Exemplo n.º 13
0
        public void RemoveStudent_RemoveOneStudent()
        {
            Course course = new Course("OS", 123);
            Student student = new Student(10000, "Pesho");
            course.AddNewStudent(student);

            Type myType = typeof(Course);
            FieldInfo setOfStudents = myType.GetField("attendingStudents", BindingFlags.NonPublic | BindingFlags.Instance);

            IList<Student> students = setOfStudents.GetValue(course) as IList<Student>;

            Assert.IsTrue(students.Contains(student));
            course.RemoveStudent(student);
            Assert.IsFalse(students.Contains(student));
        }
Exemplo n.º 14
0
        public void RemoveStudent_RemoveAllStudents()
        {
            Course course = new Course("OS", 123);
            Student[] signedStudends = new Student[course.Capacity];
            for (int i = 0; i < course.Capacity; i++)
            {
                signedStudends[i] = new Student((uint)i, "Gosho");
                course.AddNewStudent(new Student((uint)i, "Gosho"));
            }

            Type myType = typeof(Course);
            FieldInfo setOfStudents = myType.GetField("attendingStudents", BindingFlags.NonPublic | BindingFlags.Instance);

            IList<Student> students = setOfStudents.GetValue(course) as IList<Student>;

            Assert.IsTrue(students.Count == course.Capacity);

            for (int i = 0; i < course.Capacity; i++)
            {
                course.RemoveStudent(signedStudends[i]);
            }

            Assert.IsTrue(students.Count == 0);
        }
Exemplo n.º 15
0
 public void CourseRemoveNotExistingStudentFromCourseTest()
 {
     string name = "C# Course";
     Student iliqn = new Student("Iliqn Dimitrov", 21475);
     Course cSharpCourse = new Course(name);
     cSharpCourse.RemoveStudent(iliqn);
 }