示例#1
0
        public void TestAddCourseNormalAddition()
        {
            School school = new School();
            school.AddCourse(new Course("Chemistry"));

            Assert.IsTrue(school.OfferedCourses.Count == 1);
        }
示例#2
0
 public void SchoolTestAddCourseSecondTime()
 {
     var course = new Course("Javascript");
     var school = new School("Boby Georgiev");
     school.AddCourse(course);
     school.AddCourse(course);
 }
示例#3
0
        public void TestHasCourseMissingCourse()
        {
            School school = new School();
            school.AddCourse(new Course("Chemistry"));

            Assert.IsFalse(school.HasCourse(new Course("Biology")));
        }
示例#4
0
        public void TestHasCourseNullObject()
        {
            School school = new School();
            school.AddCourse(new Course("Chemistry"));

            Assert.IsFalse(school.HasCourse(null));
        }
示例#5
0
        public static void Main()
        {
            var stoyanov = new Student("Stoyanov", "54443AZ");
            var petrov = new Student("Petrov", "54444AZ", "no like");
            var mimi = new Student("Mimi", "55221RX", "very cute");

            var students = new List<Student> { stoyanov, petrov, mimi };
            

            var teachers = new List<Teacher> { new Teacher("Gadiov"), new Teacher("Ivanov"), new Teacher("Georgiev") };
            teachers[1].Detail = "The best teacher ever";

            foreach (var teacher in teachers)
            {
                Console.WriteLine("Teacher: " + teacher.Name);
            }

            foreach (var student in students)
            {
                Console.WriteLine("Student: " + student.Name + " - " + student.UniqueClassNum + " - " + student.Detail);
            }

            var history = new Discipline("History", new List<Student>() { stoyanov, petrov, mimi}, 25);
            var mechanics = new Discipline("Mechanics", new List<Student>() { mimi, petrov }, 53, "important discipline");

            var class19A = new SchoolClass("19A", students, teachers);

            var mySchool = new School(new List<SchoolClass>() { class19A });
        }
示例#6
0
        public void TestHasCourseExistingCourse()
        {
            School school = new School();
            school.AddCourse(new Course("Chemistry"));

            Assert.IsTrue(school.HasCourse(new Course("Chemistry")));
        }
        static void Main()
        {
            var someSchool = new School();
            var eveningClass = new Class("Level#2");
            var trainer = new Teacher("Mr. NakMan");
            var disciplineClassA = new Discipline("OOP", 2, 2);

            var firstStudent = new Student("Anamalech", 1);
            var thirdStudent = new Student("Corson", 3);
            var secondStudent = new Student("Boruta", 2);
            var forthStudent = new Student("Lucifer", 4);

            //Okay. Let's summon the demons... pardon, Demos!
            someSchool.AddClass(eveningClass);
            eveningClass.AddTeacher(trainer);
            trainer.AddDiscipline(disciplineClassA);

            eveningClass.AddStudent(firstStudent);
            eveningClass.AddStudent(secondStudent);
            eveningClass.AddStudent(thirdStudent);
            eveningClass.AddStudent(forthStudent);

            Console.WriteLine(eveningClass.ToString());
            Console.WriteLine();
        }
示例#8
0
文件: SchoolTest.cs 项目: elibk/KPK
        public void AddNewCourse_AddCoursesWithEqualNames()
        {
            School theSchool = new School();

            theSchool.AddNewCourse("CSharp");
            theSchool.AddNewCourse("CSharp");
        }
 public void SchoolAddCourseTest()
 {
     School school = new School();
     Course course = new Course("HQPC");
     school.AddCourse(course);
     Assert.AreEqual("HQPC", course.Name, "Adding courses to school works incorrectly.");
 }
示例#10
0
        public void SchoolTestRemoveExistentStudent()
        {
            var course = new Course("Javascript");
            var school = new School("TUES");

            school.AddCourse(course);
            school.RemoveCourse(course);
        }
        public void SchoolRemoveNotExistingStudentFromCourseTest()
        {
            School cSharpSchool = new School("C# School");
            Course cSharpCourse = new Course("C# Course");

            cSharpSchool.RemoveCourse(cSharpCourse);

            Assert.AreEqual(0, cSharpSchool.CountOfCourses());
        }
示例#12
0
        public void TestRemoveCourseNormalRemoval()
        {
            School school = new School();
            school.AddCourse(new Course("Chemistry"));
            school.AddCourse(new Course("Geography"));

            school.RemoveCourse(new Course("Chemistry"));
            Assert.IsTrue(school.OfferedCourses.Count == 1);
        }
示例#13
0
        public void SchoolTestRemoveNonExistingCourse()
        {
            var firstCourse = new Course("Javascript");
            var secondCourse = new Course("Csharp");
            var school = new School("TUES");

            school.AddCourse(firstCourse);
            school.RemoveCourse(secondCourse);
        }
        public void SchoolAddStudentInCourseTest()
        {
            School cSharpSchool = new School("C# School");
            Course cSharpCourse = new Course("C# Course");

            cSharpSchool.AddCourse(cSharpCourse);

            Assert.AreEqual(1, cSharpSchool.CountOfCourses());
        }
示例#15
0
        static void Main(string[] args)
        {
            School school = new School();
            Course<Student> course = new Course<Student>();
            Student student = new Student("A",10000);

            course[0] = student;
            school.AddCourse(course);

        }
示例#16
0
文件: SchoolTest.cs 项目: elibk/KPK
        public void AddNewCourse_AddOneCourse()
        {
            School theSchool = new School();
            theSchool.AddNewCourse("CSharp");

            School myObject = theSchool;
            Type myType = typeof(School);
            FieldInfo setOfCourses = myType.GetField("courses", BindingFlags.NonPublic | BindingFlags.Instance);

            IList<Course> courses = setOfCourses.GetValue(myObject) as IList<Course>;

            Assert.IsTrue(courses.Count == 1);
        }
示例#17
0
        public void School_ChecIsNotkUniqeNumber()
        {
            School school = new School();
            Course<Student> course = new Course<Student>();
            Student student = new Student("Anonymouse",10000);

            course[0] = student;
            school.AddCourse(course);

            bool falseCondition = School.CheckForTrueUniqeNumber(10000);

            Assert.IsFalse(falseCondition,"Probably Uniqe Number funcionalty issue in the School class.");
        }
示例#18
0
文件: SchoolTest.cs 项目: elibk/KPK
        public void AddNewStudent_AddOneStudent()
        {
            School theSchool = new School();
            theSchool.AddNewStudent("Gosho");

            School myObject = theSchool;
            Type myType = typeof(School);
            FieldInfo setOfStudents = myType.GetField("students", BindingFlags.NonPublic | BindingFlags.Instance);

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

            Assert.IsTrue(students.Count == 1);
        }
        public void SchoolRemoveCourseNonExistentTest()
        {
            List<Course> courses = new List<Course>
            {
                new Course("HQPC"),
                new Course("JS Fundamentals"),
                new Course("JS UIDOM"),
                new Course("JS OOP"),
                new Course("DSA")
            };

            Course toRemove = new Course("DB");

            School school = new School(courses);
            school.RemoveCourse(toRemove);
        }
示例#20
0
文件: SchoolTest.cs 项目: elibk/KPK
        public void AddNewStudent_AddFewStudents()
        {
            School theSchool = new School();
            int few = 5;
            for (int i = 0; i < few; i++)
            {
                theSchool.AddNewStudent("Gosho");
            }

            School myObject = theSchool;
            Type myType = typeof(School);
            FieldInfo setOfStudents = myType.GetField("students", BindingFlags.NonPublic | BindingFlags.Instance);

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

            Assert.IsTrue(students.Count == few);
        }
示例#21
0
文件: SchoolTest.cs 项目: elibk/KPK
        public void AddNewCourse_AddFewCoursesWithDifferantNames()
        {
            School theSchool = new School();
            int few = 5;
            for (int i = 0; i < few; i++)
            {
                theSchool.AddNewCourse("CSharp" + i);
            }

            School myObject = theSchool;
            Type myType = typeof(School);
            FieldInfo setOfCourses = myType.GetField("courses", BindingFlags.NonPublic | BindingFlags.Instance);

            IList<Course> courses = setOfCourses.GetValue(myObject) as IList<Course>;

            Assert.IsTrue(courses.Count == few);
        }
        public void SchoolRemoveCourseTest()
        {
            List<Course> courses = new List<Course>
            {
                new Course("HQPC"),
                new Course("JS Fundamentals"),
                new Course("JS UIDOM"),
                new Course("JS OOP"),
                new Course("DSA")
            };

            School school = new School(courses);
            school.RemoveCourse(courses[1]); // JS Fundamentals
            int expectedCoursesCount = 4;

            Assert.AreEqual(expectedCoursesCount, school.Courses.Count, "Removing existing courses from school works incorrectly.");   // 4 courses remaining
        }
示例#23
0
        public static void Main()
        {
            Student pesho = new Student("Pesho", "201411V21", "very tallented, self-critical");
            Student misho = new Student("Misho", "201411V13");

            // Student gatyo = new Student("Gosho", "201411V13"); // should throw exception
            Student gosho = new Student("Gosho", "201412V13");
            Student katya = new Student("Katya", "201412V19", "likes litterature, expecially indian novels of Karl May");

            Discipline maths = new Discipline("Mathematics", new List<Student>() { pesho, gosho, misho }, 35);
            Discipline litterature = new Discipline("Litterature", new List<Student>() { gosho, misho, katya }, 15, "optional");
            Discipline informatics = new Discipline("Informatics", new List<Student>() { pesho, gosho, katya, misho }, 50, "main discipline");

            Teacher peshova = new Teacher("Peshova", new List<Discipline>() { litterature });
            Teacher dushkov = new Teacher("Dushkov", new List<Discipline>() { maths, informatics });

            SchoolClass class201411V = new SchoolClass("201411V", new List<Student>() { pesho, misho }, new List<Teacher>() { peshova });

            // below row should throw exception
            // SchoolClass class201412 = new SchoolClass("201411V", new List<Student>() { }, new List<Teacher>() { peshova, dushkov });
            SchoolClass class201412V = new SchoolClass("201412V", new List<Student>() { }, new List<Teacher>() { peshova, dushkov });

            School eg = new School(new List<SchoolClass>() { class201411V, class201412V });
        }
示例#24
0
文件: SchoolTest.cs 项目: elibk/KPK
        public void AddNewStudent_AddTooManyStudents()
        {
            School theSchool = new School();
            Type myType = typeof(School);

            FieldInfo maxID = myType.GetField("maxID", BindingFlags.NonPublic | BindingFlags.Static);
            FieldInfo minID = myType.GetField("minID", BindingFlags.NonPublic | BindingFlags.Static);
            FieldInfo idGenerator = myType.GetField("studentIDGenerator", BindingFlags.NonPublic | BindingFlags.Instance);

            uint minimumIDValue = 10;
            uint maximumIDValue = 99;
            minID.SetValue(myType, minimumIDValue);
            maxID.SetValue(myType, maximumIDValue);
            idGenerator.SetValue(theSchool, minimumIDValue);

            for (uint count = minimumIDValue; count <= maximumIDValue + 1; count++)
            {
                theSchool.AddNewStudent("Gosho");
            }
        }
示例#25
0
文件: SchoolTest.cs 项目: elibk/KPK
 public void SignStudentForCourse_SighUnexistingStudentForCourse()
 {
     School theSchool = new School();
     Course newCourse = theSchool.AddNewCourse("CSharp");
     theSchool.SignUpStudentForCourse(10000, newCourse.Name);
 }
示例#26
0
文件: SchoolTest.cs 项目: elibk/KPK
 public void SignStudentForCourse_SighStudentForUnexistingCourse()
 {
     School theSchool = new School();
     Student newStudent = theSchool.AddNewStudent("Pesho");
     theSchool.SignUpStudentForCourse(newStudent.Id, "CSharp");
 }
示例#27
0
文件: SchoolTest.cs 项目: elibk/KPK
        public void SignStudentForCourse_SighOneStudentForOneCourse()
        {
            School theSchool = new School();
            Student newStudent = theSchool.AddNewStudent("Pesho");
            Course newCourse = theSchool.AddNewCourse("CSharp");
            theSchool.SignUpStudentForCourse(newStudent.Id, newCourse.Name);

            School myObject = theSchool;
            Type myType = typeof(School);
            FieldInfo setOfCourses = myType.GetField("courses", BindingFlags.NonPublic | BindingFlags.Instance);

            IList<Course> courses = setOfCourses.GetValue(myObject) as IList<Course>;

            Assert.IsTrue(courses[courses.IndexOf(newCourse)].IsAttendingTheCourse(newStudent));
        }
示例#28
0
文件: SchoolTest.cs 项目: elibk/KPK
 public void SignOutStudentOfCourse_SighOutUnexistingStudentOfCourse()
 {
     School theSchool = new School();
     Course newCourse = theSchool.AddNewCourse("CSharp");
     theSchool.SignOutStudentOfCourse(10000, newCourse.Name);
 }
 public void TestInitialise()
 {
     this.school = new School();
 }
示例#30
0
 public void SchoolConstructorTestNameNullValue()
 {
     var school = new School(null);
 }