public void idTestStartValue()
 {
     string name = "Petar Petrov";
     int id = 10000;
     Student student = new Student(name, id);
     Assert.AreEqual(student.ID, 10000);
 }
 public void StudentConstructorTestName()
 {
     string name = "Petar Petrov";
     int id = 12345;
     Student student = new Student(name, id);
     Assert.AreEqual(student.Name, "Petar Petrov");
 }
Example #3
0
 public void CourseRemoveStudentWhenTheListIsEmpty()
 {
     Course course = new Course("C#", new List<Student>());
     Student student = new Student("Svetlin", 11111);
     course.RemoveStudent(student);
     Assert.AreEqual(0, course.Students.Count);
 }
 public void idTestEndValue()
 {
     string name = "Petar Petrov";
     int id = 99999;
     Student student = new Student(name, id);
     Assert.AreEqual(student.ID, 99999);
 }
Example #5
0
 public void SchoolAddStudentToSchoolRegularTest()
 {
     School school = new School(new List<Student>(), new List<Course>());
     Student student = new Student("Svetlin", 11111);
     school.AddStudent(student);
     Assert.AreEqual(1, school.AllStudents.Count);
 }
 public void AddStudentTestExistingStudent()
 {
     Course course = new Course("QualityCode");
     Student petar = new Student("Petar Petrov", 12345);
     course.AddStudent(petar);
     course.AddStudent(petar);
 }
 public void CourseConstructorTestListStudents()
 {
     Course course = new Course("QualityCode");
     Student petar = new Student("Petar Petrov", 12345);
     course.AddStudent(petar);
     Assert.IsTrue(course.Students.Contains(petar));
 }
Example #8
0
 public void CourseRemoveStudentRegularTest()
 {
     Course course = new Course("C#", new List<Student>());
     Student student = new Student("Svetlin", 11111);
     course.AddStudent(student);
     course.RemoveStudent(student);
     Assert.AreEqual(0, course.Students.Count);
 }
Example #9
0
 public void CourseAddStudentWhenTheCourseIsFullTest()
 {
     Course course = new Course("C#", new List<Student>());
     for (int i = 0; i < 40; i++)
     {
         Student student = new Student("Svetlin" + i, 11100 + i);
         course.AddStudent(student);
     }
 }
Example #10
0
 public void SchoolAddCertainStudentWhoExistsAlreadyTest()
 {
     School school = new School(new List<Student>(), new List<Course>());
     Student student = new Student("Svetlin", 11111);
     Student student1 = new Student("Pesho", 11111);
     school.AddStudent(student);
     school.AddStudent(student1);
     Assert.AreEqual(1, school.AllStudents.Count);
 }
Example #11
0
        public void RemoveStudent(Student student)
        {
            if (!this.Students.Contains(student))
            {
                throw new ArgumentException("The student does not exist in this course!");
            }

            this.Students.Remove(student);
        }
Example #12
0
 public void CourseAddStudentAlreadyInTheCourseTest()
 {
     Course course = new Course("C#", new List<Student>());
     Student student = new Student("Svetlin", 11111);
     Student student1 = new Student("Svetlin", 11111);
     course.AddStudent(student);
     course.AddStudent(student1);
     Assert.AreEqual(1,course.Students.Count);
 }
Example #13
0
        public void StudentJoinCourseRegularTest()
        {
            Course course = new Course("C#", new List<Student>());
            Student student = new Student("Svetlin", 11111);

            student.JoinCourse(course);

            Assert.AreEqual(1, course.Students.Count);
        }
Example #14
0
 public void AddStudent(Student student)
 {
     int index = this.allStudents.FindIndex(stud => stud.UniqueNumber.Equals(student.UniqueNumber));
     if (index == -1)
     {
         this.allStudents.Add(student);
     }
     else
     {
         throw new ArgumentException("Student with id" + student.UniqueNumber + "Exists","student.UniqueNumber");
     }
 }
Example #15
0
        public void AddStudent(Student student)
        {
            if (this.Students.Contains(student))
            {
                throw new ArgumentException("The student joined this course already!");
            }

            if (this.Students.Count >= MaxStudents)
            {
                throw new ArgumentOutOfRangeException("The course is full!");
            }

            this.Students.Add(student);
        }
Example #16
0
 public void AddStudent(Student student)
 {
     if (this.Students.Count + 1 < 30)
     {
         int index = this.Students.FindIndex(stud => stud.UniqueNumber.Equals(student.UniqueNumber));
         if (index == -1)
         {
             this.Students.Add(student);
         }
         else
         {
             throw new ArgumentException("Student with id" + student.UniqueNumber + "Exists", "student.UniqueNumber");
         }
     }
     else
     {
         throw new InvalidOperationException("Course is full");
     }
 }
Example #17
0
 public void RemoveStudent(Student student)
 {
     this.AllStudents.Remove(student);
 }
 public void RemoveStudentTest()
 {
     Course course = new Course("QualityCode");
     course.AddStudent(new Student("Petar Petrov", 12345));
     Student todor = new Student("Todor Todorov", 54321);
     course.AddStudent(todor);
     course.RemoveStudent(todor);
     Assert.IsTrue(course.Students.Count == 1);
 }
 public void RemoveNonExistingStudentTest()
 {
     Course course = new Course("QualityCode");
     Student petar = new Student("Petar Petrov", 12345);
     course.RemoveStudent(petar);
 }
Example #20
0
 public void StudentNameStringEmptyTest()
 {
     Student student = new Student("", 11111);
 }
Example #21
0
 public void StudentUniqueNumberOutOfRangeSmallerTest()
 {
     Student student = new Student("Svetlin", 111);
 }
 public void idTestAboveEndValue()
 {
     string name = "Petar Petrov";
     int id = 100000;
     Student student = new Student(name, id);
 }
 public void idTestBelowStartValue()
 {
     string name = "Petar Petrov";
     int id = 9999;
     Student student = new Student(name, id);
 }
Example #24
0
 public void CourseStudentsPropertyMoreThan30Test()
 {
     List<Student> students = new List<Student>();
     for (int i = 0; i < 40; i++)
     {
         Student student = new Student("Svetlin"+i, 11100+i);
         students.Add(student);
     }
     Course course = new Course("C#", students);
 }
 public void NameTestEmptyString()
 {
     string name = string.Empty;
     int id = 12345;
     Student student = new Student(name, id);
 }
 public void NameTestNullValue()
 {
     string name = null;
     int id = 12345;
     Student student = new Student(name, id);
 }
 public void ToStringTest()
 {
     string name = "Petar Petrov";
     int id = 12345;
     Student student = new Student(name, id);
     string expected = "Student Petar Petrov, ID 12345; ";
     string result = student.ToString();
     Assert.AreEqual(expected, result);
 }
Example #28
0
 public void CourseStudentsPropertyRegularTest()
 {
     List<Student> students = new List<Student>();
     Student student = new Student("Svetlin", 11111);
     students.Add(student);
     Course course = new Course("C#", students);
 }
Example #29
0
        public void StudentNameAndUniqueNumberRegularTest()
        {
            Student student = new Student("Svetlin", 11111);

            Assert.AreEqual("Svetlin", student.Name);
        }