static void Main() { //Student test //Console.WriteLine("Student test"); List<Student> studentsList = new List<Student>(); studentsList.Add(new Student("Vesi", 1231532)); studentsList.Add(new Student("Natalia", 462346)); studentsList.Add(new Student("Mitko", 0982374)); //Console.WriteLine(studentsList.Print()); //Teacher test //Console.WriteLine("Teacher test"); List<Teacher> teachersList = new List<Teacher>(); teachersList.Add(new Teacher("prof. Petrov")); teachersList.Add(new Teacher("doc. Hristov")); teachersList.Add(new Teacher("as. Doneva")); teachersList[0].AddDiscipline("Computer sciense", 4, 5); teachersList[0].AddDiscipline("Hardware basics", 3, 2); teachersList[1].AddDiscipline("C# Basics", 4, 4); teachersList[1].AddDiscipline("C# OOP", 5, 5); teachersList[2].AddDiscipline("Operating Systems", 3, 2); //Console.WriteLine(teachersList.Print()); //Class test //Console.WriteLine("Class test"); Class classA = new Class('A', teachersList, studentsList); //Console.WriteLine(classA.ToString()); Class classB = new Class('B', teachersList, studentsList); classB.Comments = "This is class B"; //School test Console.WriteLine("School test:"); School TUES = new School(); TUES.AddClass(classA); TUES.AddClass(classB); Console.WriteLine(TUES.ToString()); }
static void Main() { Student student1 = new Student("Aaaa Bbb", 1); Student student2 = new Student("Cccc Ddd", 2); Student student3 = new Student("Eeee Fff", 3, "ZZZZZZZZZZZZZ"); Teacher teacher1 = new Teacher("Zzzz yyyy"); Teacher teacher2 = new Teacher("Xxxx wwww"); Discipline oop = new Discipline("oop", 12, 10, "AAAAAAAA"); Discipline Csharp = new Discipline("Csharp", 20, 14); Discipline Java = new Discipline("Java", 15, 16); teacher1.AddDisicipline(oop); teacher1.AddDisicipline(Csharp); teacher2.AddDisicipline(oop); teacher1.ListOfDisciplines.Add(Java); School MySchool = new School(); ClassInSchool MyClass = new ClassInSchool("MyClassName"); MyClass.AddStudent(student1); MyClass.AddStudent(student2); MyClass.AddStudent(student3); MyClass.AddTeacher(teacher1); MyClass.AddTeacher(teacher2); MySchool.AddClass(MyClass); System.Console.WriteLine(MyClass); }
public static void Main() { Student student1 = new Student("Aaaa Bbb", 1); Student student2 = new Student("Cccc Ddd", 2); Student student3 = new Student("Eeee Fff", 3, "ZZZZZZZZZZZZZ"); Teacher teacher1 = new Teacher("Zzzz yyyy"); Teacher teacher2 = new Teacher("Xxxx wwww"); Discipline oop = new Discipline("oop", 12, 10, "AAAAAAAA"); Discipline csharp = new Discipline("Csharp", 20, 14); Discipline java = new Discipline("Java", 15, 16); teacher1.AddDisicipline(oop); teacher1.AddDisicipline(csharp); teacher2.AddDisicipline(oop); teacher1.ListOfDisciplines.Add(java); School mySchool = new School(); ClassInSchool myClass = new ClassInSchool("MyClassName"); myClass.AddStudent(student1); myClass.AddStudent(student2); myClass.AddStudent(student3); myClass.RemoveStudent(student1); myClass.AddTeacher(teacher1); myClass.AddTeacher(teacher2); mySchool.AddClass(myClass); System.Console.WriteLine(myClass); }
static void Main() { School hogwards = new School(); Class blackMagic = new Class("Black Magic"); Teacher snape = new Teacher("Snape"); snape.Comments = "brrrrr"; Discipline blackStuffPractise = new Discipline("Black stuff and dark stuff", 1, 200); blackStuffPractise.Comments = "brr"; snape.AddDiscipline(blackStuffPractise); blackMagic.AddTeacher(snape); hogwards.AddClass(blackMagic); foreach (var clas in hogwards.Classes) { foreach (var teach in clas.Teachers) { foreach (var disc in teach.Disciplines) { Console.WriteLine(disc.Name); } } } }
static void Main() { School hogwards = new School(); Class blackMagic = new Class("Black Magic"); Teacher snape = new Teacher("Snape"); snape.Comments = "brrrrr"; Discipline blackStuffPractise = new Discipline("Black stuff and dark stuff",1,200); blackStuffPractise.Comments = "brr"; snape.AddDiscipline(blackStuffPractise); blackMagic.AddTeacher(snape); hogwards.AddClass(blackMagic); foreach (var clas in hogwards.Classes) { foreach (var teach in clas.Teachers) { foreach (var disc in teach.Disciplines) { Console.WriteLine(disc.Name); } } } }
public static void AddClass_TriesToAddNullClassToEmptyClassesDictionary_ReturnedFalseAndClassesDictionaryIsEmpty() { var school = new School(); Assert.IsFalse(school.AddClass((Class)null)); CollectionAssert.IsEmpty(school.ClassesDictionary); }
public static void AddClass_TriesToAddNotNullClassWithNullNameToEmptyClassesDictionary_ThrownArgumentNullExceptionAndClassesDictionaryIsEmpty() { var school = new School(); _ = Assert.Throws <ArgumentNullException>( () => school.AddClass(new Class(null)) ); CollectionAssert.IsEmpty(school.ClassesDictionary); }
public static void RunSchoolTest() { School newSchool = new School("Wellington School of C#"); newSchool.AddStudent(new School.Student("Pete")); newSchool.AddStudent(new School.Student("Bill")); newSchool.AddStudent(new School.Student("Roger")); newSchool.AddStudent(new School.Student("Ben")); newSchool.AddStudent(new School.Student("Susan")); newSchool.AddStudent(new School.Student("Bub")); newSchool.AddStudent(new School.Student("Morris")); newSchool.PrintAllStudents(); newSchool.AddClass(new School.SchoolClass("Basic Algorithms")); newSchool.AddClass(new School.SchoolClass("Advanced Algorithms")); newSchool.AddClass(new School.SchoolClass("Data Structures")); newSchool.AddClass(new School.SchoolClass("High Quality Code")); newSchool.PrintAllClasses(); }
static void Main() { Teacher firstTeacher = new Teacher("Doncho"); Teacher secondTeacher = new Teacher("Nakov"); Teacher thirdTeacher = new Teacher("Joro"); Teacher fourthTeacher = new Teacher("Misho"); firstTeacher.AddDiscipline("HTML", 6, 7); secondTeacher.AddDiscipline("CSharp", 6, 7); thirdTeacher.AddDiscipline("CSharp", 6, 7); fourthTeacher.AddDiscipline("HTML", 6, 7); List<Teacher> teachersTeam = new List<Teacher>() { firstTeacher, secondTeacher, thirdTeacher, fourthTeacher }; Class firstClass = new Class(teachersTeam, "First class"); Class secondClass = new Class(teachersTeam, "Second class"); School testSchool = new School(); testSchool.AddStudent("Ivo", 3423); testSchool.AddClass(firstClass); testSchool.AddClass(secondClass); Console.WriteLine("First student class number: {0}", testSchool.Students[0].ClassNumber); Console.WriteLine("First student name: {0}", testSchool.Students[0].Name); Console.WriteLine("Class Id: {0}", testSchool.Classes[0].TextId); Console.WriteLine("Second class, third teacher name: {0}", testSchool.Classes[1].Teachers[2].Name); testSchool.Students[0].Comment = "Cool"; Console.WriteLine("Comment for {0}: {1}", testSchool.Students[0].Name, testSchool.Students[0].Comment); }
public static void AddClass_AddsClassWithNotNullNameToEmptyClassesDictionary_ReturnedTrueAndClassesDictionaryEqualsToProper() { var school = new School(); var classesDictionary = school.ClassesDictionary; Assert.IsTrue(school.AddClass("1a")); CollectionAssert.AreEqual(new StringList { "1a" }, classesDictionary.Keys); Assert.AreEqual("1a", classesDictionary["1a"].Name); }
public static void AddClass_AddsNotNullClassToEmptyClassesDictionary_ReturnedTrueAndClassesDictionaryEqualsToProper() { var school = new School(); var @class = new Class("1a"); var classesDictionary = school.ClassesDictionary; Assert.IsTrue(school.AddClass(@class)); CollectionAssert.AreEqual(new StringList { "1a" }, classesDictionary.Keys); CollectionAssert.AreEqual(new ClassList { @class }, classesDictionary.Values); Assert.AreEqual(@class, classesDictionary["1a"]); }
private static void Main() { var mg = new School("Математическа гимназия - Атанас Радев"); var stanislav = new Student("Станислав Славов", 124225); var gosho = new Student("Георги Ганков", 124233); var biology = new Discipline("Биология", 10, 8); var physics = new Discipline("Физика", 8, 4); var math = new Discipline("Математика", 20, 20); var english = new Discipline("Английски език", 18, 10); var literature = new Discipline("Литература", 10, 0); var minka = new Teacher("Минка Георгиева"); var pencho = new Teacher("Пенчо Минчев"); minka.AddToughtDisciplines(biology, literature, english); pencho.AddToughtDisciplines(math, physics); var b12 = new Class("12-ти Б"); mg.AddClass(b12); b12.AddStudents(stanislav, gosho); }
static void Main() { var school = new School("St. Kliment Ohridski"); var _class = new Class("IT 3rd Semester"); var teachers = new Teacher[] { new Teacher("Peter", "Ivanov", "Georgiev").AddDiscipline(new Discipline("Math", 20, 30), new Discipline("IT", 100, 150)), new Teacher("Georgi", "Ivanov", "Ivanov").AddDiscipline(new Discipline("English")), new Teacher("Filip", "Borisov", "Hristov").AddDiscipline(new Discipline("Physics", 2, 3), new Discipline("Analisys", 5, 10)) }; var students = new Student[] { new Student("Georgi", "Ivanov", "Petrov", 1), new Student("Ivan", "Ivanov", "Georgiev", 2), new Student("Hristo", "Borisov", "Filipov", 3), new Student("Filip", "Ivanov", "Georgiev", 4), new Student("Georgi", "Ivanov", "Petrov", 5), new Student("Hristo", "Borisov", "Filipov", 6) }; school.AddClass(_class); // Add teachers and students to the class _class.AddTeacher(teachers); _class.AddStudent(students); // Remove / Add new student _class.RemoveStudent(new Student("Ivan", "Ivanov", "Georgiev", 2)); _class.AddStudent(new Student("Added", "New", "Student", 2)); // Remove / Add new teacher _class.RemoveTeacher(new Teacher("Peter", "Ivanov", "Georgiev")); _class.AddTeacher(new Teacher("Added", "New", "Teacher").AddDiscipline(new Discipline("IT", 5, 10))); Console.WriteLine(school); // Remove class school.RemoveClass(new Class("IT 3rd Semester")); Console.WriteLine(school); }
static void Main(string[] args) { Teachers teacher = new Teachers("Ivan Lorisov"); teacher.AddDiscipline(new Disciplines("Biology", 5, 5)); teacher.AddDiscipline(new Disciplines("Chemistry", 3, 6)); teacher.AddDiscipline(new Disciplines("Mathematics", 3, 8)); SchoolClasses classB = new SchoolClasses("ID123"); classB.AddStudent(new Students("Mitko Ivanov", 13)); classB.AddStudent(new Students("Pavel Penkov", 20)); classB.AddStudent(new Students("Ivaylo Tsvetkov", 25)); classB.ClassesInfo("ID123"); School school = new School(classB); school.AddClass(classB); }
public static void AddClass_TriesToAddNullClassToNotEmptyClassesDictionary_ReturnedFalseAndClassesDictionaryEqualsToProper() { var school = new School(); var @class = new Class("1a"); var classesDictionary = school.ClassesDictionary; _ = classesDictionary.Add(@class); Assert.IsFalse(school.AddClass((Class)null)); CollectionAssert.AreEqual(new StringList { "1a" }, classesDictionary.Keys); CollectionAssert.AreEqual(new ClassList { @class }, classesDictionary.Values); Assert.AreEqual(@class, classesDictionary["1a"]); }
static void Main() { School mg = new School("Математическа гимназия - Атанас Радев"); Student stanislav = new Student("Станислав Славов", 124225); Student gosho = new Student("Георги Ганков", 124233); Discipline biology = new Discipline("Биология", 10, 8); Discipline physics = new Discipline("Физика", 8, 4); Discipline math = new Discipline("Математика", 20, 20); Discipline english = new Discipline("Английски език", 18, 10); Discipline literature = new Discipline("Литература", 10, 0); Teacher minka = new Teacher("Минка Георгиева"); Teacher pencho = new Teacher("Пенчо Минчев"); minka.AddToughtDisciplines(biology, literature, english); pencho.AddToughtDisciplines(math, physics); Class B12 = new Class("12-ти Б"); mg.AddClass(B12); B12.AddStudents(stanislav, gosho); }
public static void AddClass_TriesToAddNotNullClassWithNullNameToNotEmptyClassesDictionary_ThrownArgumentNullExceptionAndClassesDictionaryEqualsToProper() { var school = new School(); var @class = new Class("1a"); var classesDictionary = school.ClassesDictionary; _ = classesDictionary.Add(@class); _ = Assert.Throws <ArgumentNullException>( () => school.AddClass(new Class(null)) ); CollectionAssert.AreEqual(new StringList { "1a" }, classesDictionary.Keys); CollectionAssert.AreEqual(new ClassList { @class }, classesDictionary.Values); Assert.AreEqual(@class, classesDictionary["1a"]); }
public static void AddClass_AddsNotNullUniqueClassToNotEmptyClassesDictionary_ReturnedTrueAndClassesDictionaryEqualsToProper() { var school = new School(); var class1 = new Class("1a"); var class2 = new Class("2a"); var classesDictionary = school.ClassesDictionary; _ = classesDictionary.Add(class1); Assert.IsTrue(school.AddClass(class2)); CollectionAssert.AreEqual(new StringList { "1a", "2a" }, classesDictionary.Keys); CollectionAssert.AreEqual(new ClassList { class1, class2 }, classesDictionary.Values); Assert.AreEqual(class1, classesDictionary["1a"]); Assert.AreEqual(class2, classesDictionary["2a"]); }
public static School AddClasses(School school) { Console.Write("Number of classes: "); int numberOfClasses = int.Parse(Console.ReadLine()); for (int i = 0; i < numberOfClasses; i++) { Console.Write("Class identifier: "); char identifier = char.Parse(Console.ReadLine()); school.AddClass(identifier); Console.Write("Number of students in this class: "); int numberOfStudentsInClass = int.Parse(Console.ReadLine()); for (int k = 0; k < numberOfStudentsInClass; k++) { Console.Write("Student name: "); string studentName = Console.ReadLine(); Console.Write("Student number in class: "); int numberInClass = int.Parse(Console.ReadLine()); school.AddStudent(studentName, numberInClass); } } return(school); }
static void Main() { string decorationLine = new string('-', 80); Console.Write(decorationLine); Console.WriteLine("***Testing the functionality of a school system***"); Console.Write(decorationLine); // Defining the school School school = new School(); // Random students List <Student> students = new List <Student>() { new Student("Gosho Goshov", 1), new Student("Ivan Ivanov", 2), new Student("Lili Petrova", 3) }; students.Add(new Student("Pesho Peshov", 4)); students[0].Comment = "I love programming!"; // Random disciplines List <Discipline> disciplines = new List <Discipline>() { new Discipline("Chemistry", 2, 3), new Discipline("Biology", 2, 2), new Discipline("Physics", 3, 3), new Discipline("Mathematics", 4, 5), new Discipline("Programming languages", 5, 10), }; // Random teachers List <Teacher> teachers = new List <Teacher>() { new Teacher("Dimityr Dimitrov", new List <Discipline>() { disciplines[2], disciplines[3] }), new Teacher("Stoqn Stoqnov", new List <Discipline>() { disciplines[0], disciplines[1] }), new Teacher("Svetlin Nakov", new List <Discipline>() { disciplines[4] }) }; // Random classes SchoolClass eleventhA = new SchoolClass("11A", students, teachers); // Adding the random classes to the school school.AddClass(eleventhA); //// This will cause exception // school.AddClass(eleventhA); // Printing all the information about the school on the console Console.Write(school); }