public void TestSchoolAddStudentTwice() { var school = new School(); var student = new Student("Name", 12345); school.AddStudent(student); school.AddStudent(student); }
public void TestCourseAddStudentTwice() { var course = new Course(); var student = new Student("Name", 12345); course.AddStudent(student); course.AddStudent(student); }
static void Main() { Student goshkoStudent = new Student("Goshko", 5); goshkoStudent.AddComment("Goshko is a bad student."); Student peshoStudent = new Student("Pesho", 10); peshoStudent.AddComment("Pesho is a normal student."); Student ivanStudent = new Student("Ivan", 11); ivanStudent.AddComment("Ivan is a great student."); Discipline maths = new Discipline("Maths", 10, 10); Discipline physics = new Discipline("Physics", 5, 4); Teacher teacher = new Teacher("Borislav Petrov", new List<Discipline>() { maths, physics }); teacher.AddComment("Borislav Petrov is a very good teacher."); teacher.AddComment("Wonderful teacher."); teacher.AddComment("Teaches only useful and interesting things."); //test comments methods teacher.ShowComments(); Console.WriteLine(); teacher.RemoveComment("Wonderful teacher."); //the comments after removed one comment teacher.ShowComments(); //clear all comments and after that nothing happens teacher.ClearAllComments(); teacher.ShowComments(); Class newClass = new Class("123", new List<Teacher>() { teacher }, new List<Student>() { goshkoStudent, peshoStudent, ivanStudent }); School school = new School(new List<Class>() { newClass }); }
public void TestCourseAddStudent() { var course = new Course(); var student = new Student("Name", 12345); course.AddStudent(student); Assert.IsTrue(course.Students.Contains(student)); }
public void TestCourseStudentLeaving() { Student studentToRemove = new Student("Pesho", 34342); IList<Student> students = new List<Student>() { new Student("Pesho", 10002), new Student("Gosho", 20003), new Student("Mariq", 30004), new Student("Pettq", 10042), studentToRemove }; Course course = new Course(students); course.Leave(studentToRemove); bool studentHasLeft = true; for (int i = 0; i < course.Students.Count; i++) { if (course.Students[i].Name == studentToRemove.Name && course.Students[i].Number == studentToRemove.Number) { studentHasLeft = false; } } Assert.AreEqual(4, students.Count, "Expected to count 4 students after removing one from the course."); Assert.IsFalse(students.ToString().Contains(studentToRemove.Number.ToString()), "Expected to remove the student from the course but found his unique number."); Assert.IsTrue(studentHasLeft, "Expected to not find a student with the same name and number"); }
public void TestSchoolAddStudent() { var school = new School(); var student = new Student("Name", 12345); school.AddStudent(student); Assert.IsTrue(school.Students.Contains(student)); }
public void TestConstructorStudentNumber() { string name = "Name"; int number = 12345; var student = new Student(name, number); Assert.AreEqual(12345, student.Number); }
public void TestSetStudentName() { string name = "Name"; int number = 12345; var student = new Student(name, number); student.Name = "New Name"; Assert.AreEqual("New Name", student.Name); }
public void TestSetStudentNumber() { string name = "Name"; int number = 12345; var student = new Student(name, number); student.Number = 11111; Assert.AreEqual(11111, student.Number); }
// Add Student in the students list public void AddStudent(Student student) { if (student == null) { throw new ArgumentNullException("School parameter is Null!"); } this.studentList.Add(student); }
public void TestCourseAddMoreThanMaximumStudents() { var course = new Course(); for (int i = 0; i <= 30; i++) { var student = new Student(i.ToString(), 10000 + i); course.AddStudent(student); } }
static void Main() { #region CREATE TEST OBJ //discipline List<Disciplines> disciplines = new List<Disciplines>(); disciplines.Add(new Disciplines("Chemistry", 4, 6)); disciplines.Add(new Disciplines("Math", 10, 10)); disciplines.Add (new Disciplines("Biology", 8, 6)); disciplines.Add(new Disciplines("Insurance", 10, 6)); disciplines.Add(new Disciplines("Informatics", 10, 16)); //teachers List<Teacher> teachers = new List<Teacher>(); teachers.Add(new Teacher("Manolov",disciplines.GetRange(3,1))); teachers.Add(new Teacher("Minkov",disciplines.GetRange(0,2))); teachers.Add(new Teacher("Marinov", disciplines.GetRange(2, 1))); teachers.Add(new Teacher("Ovcharov", disciplines.GetRange(0, 3))); //students List<Student> students = new List<Student>(); students.Add(new Student("Martin", 3)); students.Add(new Student("Darin", 13)); students.Add(new Student("Rumqna", 6)); students.Add(new Student("Emil", 33)); students.Add(new Student("Nikola", 7)); students.Add(new Student("Georgi", 1)); //SchoolClasses List<SchoolClass> schoolClasses = new List<SchoolClass>(); schoolClasses.Add(new SchoolClass(teachers, students, "3133")); //school School school = new School("School Akademy",schoolClasses); #endregion //-----TEST SCHOOL------- Console.WriteLine(school); #region TEST OPTIONAL COMMENTS Student vasko = new Student("Vasko",3); vasko.FreeComments = "OPTIONAL COMMENT TEST"; vasko.ShowFreeComments(); Teacher ra = new Teacher("Vasko", disciplines); ra.FreeComments = "OPTIONAL COMMENT TEST"; ra.ShowFreeComments(); SchoolClass da = new SchoolClass(teachers,students,"31231"); da.FreeComments = "OPTIONAL COMMENT TEST"; da.ShowFreeComments(); #endregion }
public void AddStudent(Student student) { bool isInThisClass = this.Students.Count(x => x.Fn == student.Fn) == 0; if (!isInThisClass) { this.Students.Add(student); } Console.WriteLine("There is a student in class with this class number."); }
public void Leave(Student student) { for (int i = 0; i < this.Students.Count; i++) { if (this.Students[i].Name == student.Name && this.Students[i].Number == student.Number) { this.Students.RemoveAt(i); i--; } } }
public void AddStudent(Student student) { if (!this.Students.Contains(student)) { this.Students.Add(student); Console.WriteLine("Student {0} added to class {1}!", student.Name, this.ID); } else { Console.WriteLine("Student {0} is already a member of the clas {1}!", student.Name, this.ID); } }
public void ExpelStudent(Student student) { if (this.Students.Contains(student)) { this.Students.Remove(student); Console.WriteLine("The student {0} is expelled from class {1}", student.Name, this.ID); } else { Console.WriteLine("The student {0} does not belong to the class {1}", student.Name, this.ID); } }
public void TestCourseExceedingMaxNumberOfStudentsWhenJoining() { Student studentToJoin = new Student("Pesho", 34342); IList<Student> students = new List<Student>(); Course course = new Course(students); int startingNumber = 10000; for (int i = 0; i < Course.MaxStudentCapacity + 1; i++) { course.Join(new Student("Pesho", startingNumber + i)); } }
public void RemoveStudent(Student student) { if (student == null) { throw new ArgumentNullException("The student to be removed could not be null!"); } if (!this.Students.Contains(student)) { throw new InvalidOperationException("Could not remove " + student.Name + " which is not presented in the school!"); } this.Students.Remove(student); }
public void AddStudent(Student student) { if (student == null) { throw new ArgumentNullException("The student to be added could not be null!"); } if (this.Students.Contains(student)) { throw new InvalidOperationException(student.Name + " is already added in the school!"); } this.Students.Add(student); }
public void AddStudent(Student student) { if (this.StudentsCount() >= MaxStudentsCount) { throw new ArgumentOutOfRangeException("Can not add new student to course because the course is full."); } if (this.IsStudentJoinedCourse(student)) { throw new ArgumentException("Student can not join the same course twice."); } this.students.Add(student); }
// Remove Student from the students list public bool RemoveStudent(Student student) { if (student == null) { throw new ArgumentNullException("School parameter is Null!"); } if (!this.studentList.Contains(student)) { return false; } return this.studentList.Remove(student); }
public void RemoveStudent(Student student) { if (!this.IsStudentJoinedCourse(student)) { throw new ArgumentException("There is no such student to remove from this course."); } var index = 0; foreach (var st in this.Students) { if (st.Id == student.Id && st.Name == student.Name) { (this.students as List<Student>).RemoveAt(index); break; } index++; } }
public void AddStudent(Student student) { if (this.Students.Count == Course.MaxCapacity) { throw new ApplicationException("The course maximum capacity is exceeded!"); } if (student == null) { throw new ArgumentNullException("The student to be added could not be null!"); } if (this.Students.Contains(student)) { throw new InvalidOperationException(student.Name + " is already added in the course!"); } this.Students.Add(student); }
public static void Main() { Discipline firstDiscipline = new Discipline("history", 2, 5); Discipline secondDiscipline = new Discipline("math", 8, 4); Student firstStudent = new Student("Daniel", 1); Student secondStudent = new Student("Ivan", 2); Teacher firstTeacher = new Teacher("Petrov", new List<Discipline> { firstDiscipline, secondDiscipline }); Class firstClass = new Class("1A", new List<Student> { firstStudent, secondStudent }, new List<Teacher> { firstTeacher }); School firstSchool = new School(new List<Class> { firstClass }); Console.WriteLine("The name of the first discipline of the first teacher in 1A class is: {0}",firstSchool.Classes[0].Teachers[0].SetOfDisciplines[0].Name); firstSchool.Classes[0].Comment = "The best students ever!"; Console.WriteLine(firstSchool.Classes[0].Comment); }
public static void School() { //creating instances of Student class Student angel = new Student("Angel Dragomirov", 1); Student ivan = new Student("Ivan Dragomirov", 11); Student georgi = new Student("Georgi Haralampiev", 7); //creating instances of Teacher class Teacher petrov = new Teacher("Kiril Petrov"); Teacher ivanov = new Teacher("Marian Ivanov"); //Adding techers knowledge disciplines petrov.Subjects.Add(Discipline.Math); petrov.Subjects.Add(Discipline.Chemistry); ivanov.Subjects.Add(Discipline.AmericanEnglish); ivanov.Subjects.Add(Discipline.BritishEnglish); //creating instance of SchoolClass class SchoolClass AClass = new SchoolClass("AClass"); //adding Students to the SchoolClass AClass.Students.Add(angel); AClass.Students.Add(ivan); AClass.Students.Add(georgi); //adding Teacher to the SchoolClass AClass.Teachers.Add(petrov); AClass.Teachers.Add(ivanov); //creating instance of School School mySchool = new School(51, "Elisaveta Bagryana"); //adding SchoolClass to the School mySchool.Classes.Add(AClass); //adding optional comment AClass.About = "Geeks"; }
static void Main(string[] args) { Student pesho = new Student("Pesho",1234); Student mariika = new Student("Mariika",1235); mariika.Details = "Keep eyes on her, is very horny !"; Discipline cSharp = new Discipline("C#",2,pesho,mariika); Teacher nakov = new Teacher("Svetlin Nakov",cSharp); Teacher vlado = new Teacher("Vlado Karamfilov", cSharp); Class firstLevel = new Class(nakov, "Level 2"); IHuman[] allPeopleInSchool = new IHuman[] { vlado, pesho, mariika, nakov}; var sortedPpl = allPeopleInSchool.OrderBy(p => p.GetType() == typeof(Student)).ThenBy(p=>p.Name).ToList(); //Console.WriteLine(mariika.Name +" Number "+ mariika.UniqueClassNumber +" Details: "+mariika.Details); foreach (var ppl in sortedPpl) { //Sorted By Teachers then Students Console.WriteLine(ppl.Name); } Console.WriteLine(); }
public void StudentsConstructorGreaterIdTest() { var studentId = 100000; var student = new Student("Pesho", studentId); }
public void StudentsConstructorSmallerIdTest() { var studentId = 5; var student = new Student("Pesho", studentId); }
public void StudentsConstructorNameEmptyTest() { var studentName = string.Empty; var student = new Student(studentName, 15000); }
public void StudentsConstructorNameNullTest() { string studentName = null; var student = new Student(studentName, 15000); }