public void TestNewStudentConstructorId() { string name = "Ivan Ivanov"; int id = 12233; Student student = new Student(name, id); Assert.AreEqual(student.StudentId, id); }
public void TestNewStudentConstructorOnMaxLimitId() { string name = "Ivan Ivanov"; int id = 99999; Student student = new Student(name, id); Assert.AreEqual(id, student.StudentId); }
public void TestRemoveNotAddedStudent() { string name = "40 SOU"; Student student = new Student("Ivan Ivanov", 12233); School school = new School(name); school.RemoveStudent(student); }
public void TestAddStudentId() { string name = "40 SOU"; Student student = new Student("Ivan Ivanov", 12233); School school = new School(name); school.AddStudent(student); Assert.AreEqual(student.StudentId, school.StudentsList[0].StudentId); }
public void TestJoinTheSameStudentId() { string name = "Crocheting"; Student student = new Student("Ivan Ivanov", 12233); Course course = new Course(name); course.Join(student); course.Join(student); }
public void TestJoinStudentId() { string name = "Crocheting"; Student student = new Student("Ivan Ivanov", 12233); Course course = new Course(name); course.Join(student); Assert.AreEqual(student.StudentId, course.StudentsList[0].StudentId); }
public void TestLeaveStudent() { string name = "Crocheting"; Student student = new Student("Ivan Ivanov", 12233); Course course = new Course(name); course.Join(student); course.Leave(student); Assert.IsTrue(course.StudentsList.Count == 0); }
public void TestRemoveStudent() { string name = "40 SOU"; Student student = new Student("Ivan Ivanov", 12233); School school = new School(name); school.AddStudent(student); school.RemoveStudent(student); Assert.IsTrue(school.StudentsList.Count == 0); }
public void AddStudent(Student student) { if (this.IsStudentFound(student)) { throw new ArgumentException( string.Format( "The student ID {0} already exists in the school's students list! Please choose a differnet student ID for student {1}", student.StudentId, student.Name)); } else { this.StudentsList.Add(student); } }
public void RemoveStudent(Student student) { if (this.IsStudentFound(student)) { this.StudentsList.Remove(student); } else { throw new ArgumentException( string.Format( "Student not removed! The student ID {0} for student {1} dosn't exsit in the school's records!", student.StudentId, student.Name)); } }
public void Leave(Student student) { if (this.IsStudentFound(student)) { this.StudentsList.Remove(student); } else { throw new ArgumentException( string.Format( "The student {0} {1} cannot leave the course because he/she hasn't joined this course!", student.StudentId, student.Name)); } }
public void Join(Student student) { if (this.IsStudentFound(student)) { throw new ArgumentException( string.Format( "The student {0} {1} has already joined this course!", student.StudentId, student.Name)); } else if (this.IsCourseFull()) { throw new ArgumentOutOfRangeException("The course is full at the moment and doesn't accept new students!"); } else { this.StudentsList.Add(student); } }
private bool IsStudentFound(Student student) { for (int i = 0; i < this.StudentsList.Count; i++) { if (student.StudentId == this.StudentsList[i].StudentId) { return true; } } return false; }
public void TestLeaveNotJoinedStudent() { string name = "Crocheting"; Student student = new Student("Ivan Ivanov", 12233); Course course = new Course(name); course.Leave(student); }
public void TestNewStudentConstructorEmptyName() { string name = string.Empty; int id = 12233; Student student = new Student(name, id); }
public void TestNewStudentConstructorPositiveLimitOfIntId() { string name = "Ivan Ivanov"; int id = int.MaxValue; Student student = new Student(name, id); }
public void TestNewStudentConstructorNegativeId() { string name = "Ivan Ivanov"; int id = -1112; Student student = new Student(name, id); }
public void TestNewStudentConstructorBelowMinLimitId() { string name = "Ivan Ivanov"; int id = 9999; Student student = new Student(name, id); }
public void TestStudentToString() { string name = "Ivan Ivanov"; int id = 12233; Student student = new Student(name, id); string expected = "12233 Ivan Ivanov"; string actual = student.ToString(); Assert.AreEqual(expected, actual); }
public void TestNewStudentConstructorZeroId() { string name = "Ivan Ivanov"; int id = 0; Student student = new Student(name, id); }
public void TestStudentToString() { string name = "Crocheting"; Course course = new Course(name); Student student = new Student("Ivan Ivanov", 12233); course.Join(student); string expected = string.Format("Course: Crocheting{0}Subscribed students{0}12233 Ivan Ivanov{0}", Environment.NewLine); string actual = course.ToString(); Assert.AreEqual(expected, actual); }
public void TestNewStudentConstructorNullName() { string name = null; int id = 12233; Student student = new Student(name, id); }
public void AddStudent(Student student) { Students.Add(student); }
static void Main() { //Create a school School testSchool = new School("40 - SOU Loui Pastior"); testSchool.Title = "40 - SOU Loui Pastior"; //Add disciplines Discipline maths = new Discipline("Mathematics", 30, 30); Discipline bgLang = new Discipline("Bulgarian Language", 30, 30); Discipline enLang = new Discipline("English Language", 20, 20); //Add Students Student Ivanov = new Student("Ivan Ivanov", 1); Student Petrov = new Student("Ivan Petrov", 2); Student Ivanova = new Student("Petia Ivanova", 1); Student Ilieva = new Student("Kalina Ilieva", 2); Student Kostov = new Student("Jordan Kostov", 3); Student Kirchev = new Student("Pencho Kirchev", 4); //Add Teachers Teacher Petrova = new Teacher("Tania Petrova", new List<Discipline> {maths, enLang }); Teacher Georgiev = new Teacher("Georgi Georgiev", new List<Discipline> { bgLang, enLang }); //Add some comments Georgiev.AddComment("Only morning classes"); Georgiev.AddComment("Free Wednesdays"); Ivanova.AddComment("Not present every second Tuesday due to medical issues"); //Add 2 classes SchoolClass firstA = new SchoolClass("I A", new List<Student>() , new List<Teacher> ()); firstA.AddStudent(Ivanov); firstA.AddStudent(Petrov); firstA.AddStudent(Kostov); firstA.AddStudent(Kirchev); firstA.AddTeacher(Petrova); testSchool.AddSchoolClass( firstA); SchoolClass firstB = new SchoolClass("I B", new List<Student> (), new List<Teacher>()); firstB.AddStudent(Ivanova); firstB.AddStudent(Ilieva); firstB.AddTeacher(Petrova); firstB.AddTeacher(Georgiev); testSchool.AddSchoolClass(firstB); //Print on the console Console.WriteLine("Information about a discipline:"); Console.WriteLine(maths); Console.WriteLine(); Console.WriteLine("Information about a teacher:"); Console.WriteLine(Georgiev); Console.WriteLine(); Console.WriteLine("Information about a student:"); Console.WriteLine(Ilieva); Console.WriteLine(); Console.WriteLine("Information about a school class:"); Console.WriteLine(firstA); Console.WriteLine(); Console.WriteLine("Information about a school:"); Console.WriteLine(testSchool); }