コード例 #1
0
 public void TestAddStudentExceptionWhenAlreadyAdded()
 {
     School school = new School("GLFL Simeon Radev");
     Course course = new Course("There is such course in the school!");
     school.AddCourse(course);
     school.AddCourse(course);
 }
コード例 #2
0
 public void TestAddStudentExceptionWhenAlreadyAdded()
 {
     Course course = new Course("Math");
     Student student = new Student("Pesho");
     course.AddStudent(student);
     course.AddStudent(student);
 }
コード例 #3
0
ファイル: SchoolTest.cs プロジェクト: Bunny303/TelerikAcademy
 public void RemoveNonExistingCourseTest()
 {
     List<Course> courses = new List<Course>();
     School school = new School();
     Course javascript = new Course("Javascript");
     school.RemoveCourse(javascript);
 }
コード例 #4
0
 public void TestRemoveStudentExceptionWhenNotExisting()
 {
     School school = new School("GLFL Simeon Radev");
     Course courseOne = new Course("Math");
     Course courseTwo = new Course("Physics");
     school.AddCourse(courseOne);
     school.RemoveCourse(courseTwo);
 }
コード例 #5
0
 public void TestRemoveStudentExceptionWhenNotExisting()
 {
     Course course = new Course("Math");
     Student studentOne = new Student("Pesho");
     Student studentTwo = new Student("Gosho");
     course.AddStudent(studentOne);
     course.RemoveStudent(studentTwo);
 }
コード例 #6
0
 public void TestAddStudentExceptionWhenStudentsTooMuch()
 {
     Course course = new Course("Math");
     for (int i = 0; i <= 30; i++)
     {
         course.AddStudent(new Student("Pesho"));
     }
 }
コード例 #7
0
ファイル: SchoolTest.cs プロジェクト: Bunny303/TelerikAcademy
 public void AddCourseTest()
 {
     List<Course> courses = new List<Course>();
     Course javascript = new Course("Javascript");
     School school = new School();
     school.AddCourse(javascript);
     Assert.AreEqual(javascript.Name, school.Courses[0].Name);
 }
コード例 #8
0
ファイル: CourseTest.cs プロジェクト: Bunny303/TelerikAcademy
 public void AddStudentTestOneStudent()
 {
     string name = "Javascript";
     IList<Student> students = new List<Student>();
     Course course = new Course(name);
     Student maria = new Student("Maria Petrova", 12345);
     course.AddStudent(maria);
     Assert.IsTrue(course.Students.Count == 1);
 }
コード例 #9
0
ファイル: CourseTest.cs プロジェクト: Bunny303/TelerikAcademy
 public void AddStudentTestSameStudentTwoTimes()
 {
     string name = "Javascript";
     IList<Student> students = new List<Student>();
     Course course = new Course(name);
     Student maria = new Student("Maria Petrova", 12345);
     course.AddStudent(maria);
     course.AddStudent(maria);
 }
コード例 #10
0
ファイル: SchoolTest.cs プロジェクト: Bunny303/TelerikAcademy
 public void RemoveCourseTest()
 {
     List<Course> courses = new List<Course>();
     School school = new School();
     Course javascript = new Course("Javascript");
     school.AddCourse(javascript);
     school.RemoveCourse(javascript);
     Assert.IsTrue(school.Courses.Count == 0);
 }
コード例 #11
0
ファイル: School.cs プロジェクト: Bunny303/TelerikAcademy
        public void RemoveCourse(Course course)
        {
            bool isCourseFound = this.FindCourse(course);
            if (!isCourseFound)
            {
                throw new ArgumentException("The course is not in the school!");
            }

            this.Courses.Remove(course);
        }
コード例 #12
0
ファイル: CourseTest.cs プロジェクト: Bunny303/TelerikAcademy
 public void AddStudentTestTwoStudents()
 {
     string name = "Javascript";
     IList<Student> students = new List<Student>();
     Course course = new Course(name);
     Student maria = new Student("Maria Petrova", 12345);
     Student petar = new Student("Petar Marinov", 23445);
     course.AddStudent(maria);
     course.AddStudent(petar);
     Assert.IsTrue(course.Students.Count == 2);
 }
コード例 #13
0
ファイル: School.cs プロジェクト: VelizarIT/TelerikAcademy
        public void AddCourse(Course course)
        {
            if (course == null)
            {
                throw new ArgumentNullException("Course name cannot be null!");
            }
            if (HasCourse(course.Name))
            {
                throw new InvalidOperationException("There is such course in the school!");
            }

            this.courses.Add(course);
        }
コード例 #14
0
ファイル: School.cs プロジェクト: Bunny303/TelerikAcademy
        private bool FindCourse(Course course)
        {
            bool isFound = false;
            for (int i = 0; i < this.Courses.Count; i++)
            {
                if (this.Courses[i].Name == course.Name)
                {
                    isFound = true;
                }
            }

            return isFound;
        }
コード例 #15
0
ファイル: School.cs プロジェクト: VelizarIT/TelerikAcademy
        public void RemoveCourse(Course course)
        {
            if (!HasCourse(course.Name))
            {
                throw new KeyNotFoundException("Course with this name doesn't exist in the school!");
            }

            for (int i = 0; i < this.courses.Count; i++)
            {
                if (course.Name == this.courses[i].Name)
                {
                    this.courses.RemoveAt(i);
                }
            }
        }
コード例 #16
0
        public void TestAddStudentRemoveStudent()
        {
            Course course = new Course("Math");
            Student student = new Student("Pesho");

            course.AddStudent(new Student("Gosho"));
            Assert.AreEqual(course.Students.Count, 1);

            course.AddStudent(student);
            Assert.AreEqual(course.Students.Count, 2);
            Assert.AreEqual(course.Students[1].Name, "Pesho");

            course.RemoveStudent(student);
            Assert.AreEqual(course.Students.Count, 1);
            Assert.AreEqual(course.Students[0].Name, "Gosho");
        }
コード例 #17
0
        public void TestAddCourseRemoveCourse()
        {
            School school = new School("GLFL Simeon Radev");
            Course course = new Course("Math");

            school.AddCourse(new Course("Physics"));
            Assert.AreEqual(school.Courses.Count, 1);

            school.AddCourse(course);
            Assert.AreEqual(school.Courses.Count, 2);
            Assert.AreEqual(school.Courses[1].Name, "Math");

            school.RemoveCourse(course);
            Assert.AreEqual(school.Courses.Count, 1);
            Assert.AreEqual(school.Courses[0].Name, "Physics");
        }
コード例 #18
0
ファイル: CourseTest.cs プロジェクト: Bunny303/TelerikAcademy
 public void AddStudentTestMoreThanMaximumStudents()
 {
     string name = "Javascript";
     IList<Student> students = new List<Student>();
     Course course = new Course(name);
     course.AddStudent(new Student("Maria Petrova", 12345));
     course.AddStudent(new Student("Maria Petrova", 12346));
     course.AddStudent(new Student("Maria Gocheva", 12347));
     course.AddStudent(new Student("Maria Mihaylova", 12348));
     course.AddStudent(new Student("Maria Grozeva", 12349));
     course.AddStudent(new Student("Maria Toneva", 12350));
     course.AddStudent(new Student("Maria Gecheva", 12351));
     course.AddStudent(new Student("Maria Gacheva", 12352));
     course.AddStudent(new Student("Maria Donkova", 12353));
     course.AddStudent(new Student("Maria Vrankova", 12354));
     course.AddStudent(new Student("Maria Drakonova", 12355));
     course.AddStudent(new Student("Maria Bobeva", 12356));
     course.AddStudent(new Student("Maria Kateva", 12357));
     course.AddStudent(new Student("Maria Bonkova", 12358));
     course.AddStudent(new Student("Maria Kolova", 12359));
     course.AddStudent(new Student("Maria Simova", 12360));
     course.AddStudent(new Student("Maria Koleva", 12361));
     course.AddStudent(new Student("Maria Popova", 12362));
     course.AddStudent(new Student("Maria Tsolova", 12363));
     course.AddStudent(new Student("Maria Doneva", 12364));
     course.AddStudent(new Student("Maria Dakova", 12365));
     course.AddStudent(new Student("Maria Makova", 12366));
     course.AddStudent(new Student("Maria Petkova", 12367));
     course.AddStudent(new Student("Maria Kamenova", 12368));
     course.AddStudent(new Student("Maria Vuchkova", 12369));
     course.AddStudent(new Student("Maria Komnina", 12370));
     course.AddStudent(new Student("Maria Burdina", 12371));
     course.AddStudent(new Student("Maria Hristova", 12372));
     course.AddStudent(new Student("Petar Marinov", 23445));
     course.AddStudent(new Student("Petar Krastev", 23446));
 }
コード例 #19
0
ファイル: CourseTest.cs プロジェクト: Bunny303/TelerikAcademy
 public void NameTestEmptyString()
 {
     string name = string.Empty;
     Course newCourse = new Course(name);
 }
コード例 #20
0
 public void TestConstructor()
 {
     Course course = new Course("Math");
     Assert.AreEqual(course.Name, "Math");
 }
コード例 #21
0
 public void TestAddStudentExceptionWhenNull()
 {
     Course course = new Course("Math");
     course.AddStudent(null);
 }
コード例 #22
0
ファイル: CourseTest.cs プロジェクト: Bunny303/TelerikAcademy
 public void CourseConstructorTestListStudents()
 {
     string name = "Javascript";
     Student maria = new Student("Maria Petrova", 12345);
     IList<Student> students = new List<Student>();
     Course course = new Course(name);
     course.AddStudent(maria);
     Assert.IsTrue(course.Students.Contains(maria));
 }
コード例 #23
0
ファイル: CourseTest.cs プロジェクト: Bunny303/TelerikAcademy
 public void CourseConstructorTestName()
 {
     string name = "Javascript";
     Course course = new Course(name);
     Assert.AreEqual(course.Name, "Javascript");
 }
コード例 #24
0
ファイル: CourseTest.cs プロジェクト: Bunny303/TelerikAcademy
 public void ToStringTestTwoStudents()
 {
     string name = "Javascript";
     Student maria = new Student("Maria Petrova", 12345);
     Student petar = new Student("Petar Marinov", 23445);
     IList<Student> students = new List<Student>();
     Course javascript = new Course(name);
     javascript.AddStudent(maria);
     javascript.AddStudent(petar);
     string expected = "Course name Javascript; Student Maria Petrova, ID 12345; Student Petar Marinov, ID 23445; ";
     string actual;
     actual = javascript.ToString();
     Assert.AreEqual(expected, actual);
 }
コード例 #25
0
 public void TestNameExceptionWhenNull()
 {
     Course course = new Course(null);
 }
コード例 #26
0
ファイル: School.cs プロジェクト: Bunny303/TelerikAcademy
 public void AddCourse(Course course)
 {
     this.Courses.Add(course);
 }
コード例 #27
0
ファイル: CourseTest.cs プロジェクト: Bunny303/TelerikAcademy
 public void NameTestNullValue()
 {
     string name = null;
     Course newCourse = new Course(name);
 }
コード例 #28
0
ファイル: CourseTest.cs プロジェクト: Bunny303/TelerikAcademy
 public void RemoveNonExistingStudentTest()
 {
     string name = "Javascript";
     IList<Student> students = new List<Student>();
     Course course = new Course(name);
     Student maria = new Student("Maria Petrova", 12345);
     course.RemoveStudent(maria);
 }
コード例 #29
0
 public void TestNameExceptionWhenEmpty()
 {
     Course course = new Course("");
 }