AddCourse() public method

public AddCourse ( Course course ) : void
course Course
return void
コード例 #1
0
ファイル: SchoolTest.cs プロジェクト: slop3n/TelerikAcademy
 public void RemoveCourseFromSchool()
 {
     var school = new School("Telerik Academy");
     var javascript = new Course("Javascript");
     var html = new Course("HTML");
     school.AddCourse(javascript);
     school.AddCourse(html);
     school.RemoveCourse(html);
     string expected = school.ToString();
     string actual = "Course number: 1\nCourse name: Javascript\n";
     Assert.AreEqual(expected, actual);
 }
コード例 #2
0
        public void TestRemoveCourse()
        {
            School.School s  = new School.School("foo");
            Course        c1 = new Course("Math");
            Course        c2 = new Course("Biology");

            s.AddCourse(c1);
            s.AddCourse(c2);

            Course removed = s.RemoveCourse("Math");

            Assert.AreEqual(removed, c1);
        }
コード例 #3
0
ファイル: SchoolTests.cs プロジェクト: bahtev/TelerikAcademy
        public void TestRemoveCourse()
        {
            School.School s = new School.School("foo");
            Course c1 = new Course("Math");
            Course c2 = new Course("Biology");

            s.AddCourse(c1);
            s.AddCourse(c2);

            Course removed = s.RemoveCourse("Math");

            Assert.AreEqual(removed, c1);
        }
コード例 #4
0
        public void TestAddingNullCourse()
        {
            School.School s = new School.School("MySchool");
            Course        c = null;

            s.AddCourse(c);
        }
コード例 #5
0
        public void TestAddExistingCourse()
        {
            List <Course> courses = new List <Course>()
            {
                new Course("HTML", this.students),
                new Course("CSS", this.students),
                new Course("C#", this.students),
                new Course("JS", this.students),
            };

            School.School tu   = new School.School("TU", courses);
            Course        algo = new Course("Algorithms", students);

            tu.AddCourse(algo);
            tu.AddCourse(algo);
        }
コード例 #6
0
        public void TestAddCourse1()
        {
            School school = new School("Telerik");
            Course course = new Course("JavaScript");

            school.AddCourse(course);
            Assert.AreEqual(1, school.Courses.Count, "Course was not added successfully.");
        }
コード例 #7
0
        public void AddingCourseShouldIncreazeNumberOfCourses()
        {
            var school = new School();
            var course = new Course("pesho");
            school.AddCourse(course);

            Assert.AreEqual(1, school.CoursesCount, "Courses adding does not increaze count");
        }
コード例 #8
0
        public void TestRemoveCourse2()
        {
            School school = new School("Telerik");
            Course course = new Course("JavaScript");

            school.AddCourse(course);
            school.RemoveCourse(new Course("Web"));
            Assert.AreEqual(0, school.Courses.Count, "Course was not removed successfully.");
        }
コード例 #9
0
        static void Main()
        {
            School school = new School("NPMG");
            List<Disciple> disciplines = LoadDisciplines();
            Teacher dimo = new Teacher("Dimo Padalski", disciplines);

            Course geography = new Course("Geography");
            geography.AddTeacher(dimo);
            school.AddCourse(geography);

            Teacher dimo2 = new Teacher("Dimo Padalski II", disciplines);

            Course geography2 = new Course("Geography2");
            geography2.AddTeacher(dimo2);
            school.AddCourse(geography2);

            Console.WriteLine(PrintSchoolInfo(school));
        }
コード例 #10
0
ファイル: SchoolTests.cs プロジェクト: bahtev/TelerikAcademy
        public void TestAddFewCourses()
        {
            School.School s = new School.School("PMG");

            Course c1 = new Course("Math");
            Course c2 = new Course("Physics");
            Course c3 = new Course("Chemistry");

            s.AddCourse(c1);
            s.AddCourse(c2);
            s.AddCourse(c3);

            bool result = s.Courses.Count == 3;
            result = result && s.Courses[0].Name == c1.Name;
            result = result && s.Courses[1].Name == c2.Name;
            result = result && s.Courses[2].Name == c3.Name;

            Assert.IsTrue(result);
        }
コード例 #11
0
        public void TestRemoveMissingStudent()
        {
            School.School s  = new School.School("bar");
            Course        c  = new Course("Math");
            Course        c1 = new Course("alpha");
            Course        c2 = new Course("beta");

            s.AddCourse(c);
            s.AddCourse(c1);
            s.AddCourse(c2);

            Course removed = s.RemoveCourse("omega");
            bool   result  = removed == null;

            result = result && s.Courses[0] == c &&
                     s.Courses[1] == c1 && s.Courses[2] == c2;

            Assert.IsTrue(result);
        }
コード例 #12
0
        public void TestAddFewCourses()
        {
            School.School s = new School.School("PMG");

            Course c1 = new Course("Math");
            Course c2 = new Course("Physics");
            Course c3 = new Course("Chemistry");

            s.AddCourse(c1);
            s.AddCourse(c2);
            s.AddCourse(c3);

            bool result = s.Courses.Count == 3;

            result = result && s.Courses[0].Name == c1.Name;
            result = result && s.Courses[1].Name == c2.Name;
            result = result && s.Courses[2].Name == c3.Name;

            Assert.IsTrue(result);
        }
コード例 #13
0
ファイル: Tests.cs プロジェクト: Termininja/TelerikAcademy
        public void InitializeSchool()
        {
            school = new School("School");
            firstCourse = new Course("Math");
            secondCourse = new Course("Bio");
            firstStudent = new Student("Ivan", 20000);
            secondStudent = new Student("Maria", 20000);

            firstCourse.AddStudent(firstStudent);
            school.AddCourse(firstCourse);
        }
コード例 #14
0
ファイル: SchoolTest.cs プロジェクト: slop3n/TelerikAcademy
 public void InitializeSchoolTest()
 {
     var school = new School("Telerik Academy");
     var javascript = new Course("Javascript");
     var pesho = new Student("Pesho", 10111);
     javascript.AddStudent(pesho);
     school.AddCourse(javascript);
     string expected = "Course number: 1\nCourse name: Javascript\nStudent name is: Pesho, with id: 10111\n";
     string actual = school.ToString();
     Assert.AreEqual(expected, actual);
 }
コード例 #15
0
        static void Main()
        {
            School          school      = new School("NPMG");
            List <Disciple> disciplines = LoadDisciplines();
            Teacher         dimo        = new Teacher("Dimo Padalski", disciplines);

            Course geography = new Course("Geography");

            geography.AddTeacher(dimo);
            school.AddCourse(geography);

            Teacher dimo2 = new Teacher("Dimo Padalski II", disciplines);

            Course geography2 = new Course("Geography2");

            geography2.AddTeacher(dimo2);
            school.AddCourse(geography2);

            Console.WriteLine(PrintSchoolInfo(school));
        }
コード例 #16
0
        public void TestSeveralCoursesWithSameName()
        {
            School.School s  = new School.School("bar");
            Course        c  = new Course("Math");
            Course        c1 = new Course("alpha");
            Course        c2 = new Course("beta");
            Course        c3 = new Course("gama");
            Course        c4 = new Course("Math");
            Course        c5 = new Course("Math");

            s.AddCourse(c);
            s.AddCourse(c1);
            s.AddCourse(c2);
            s.AddCourse(c3);
            s.AddCourse(c4);
            s.AddCourse(c5);

            Course removed = s.RemoveCourse("Math");

            bool result = removed == c;

            result = result && s.Courses[0] == c1 &&
                     s.Courses[1] == c2 && s.Courses[2] == c3 &&
                     s.Courses[3] == c4 && s.Courses[4] == c5;

            Assert.IsTrue(result);
        }
コード例 #17
0
        public void TestAddNullCourse()
        {
            List <Course> courses = new List <Course>()
            {
                new Course("HTML", this.students),
                new Course("CSS", this.students),
                new Course("C#", this.students),
                new Course("JS", this.students),
            };

            School.School tu = new School.School("TU", courses);
            tu.AddCourse(null);
        }
コード例 #18
0
        public void TestAddCourseWithValidCourse()
        {
            List <Course> courses = new List <Course>()
            {
                new Course("HTML", this.students),
                new Course("CSS", this.students),
                new Course("C#", this.students),
                new Course("JS", this.students),
            };

            School.School academy = new School.School("Telerik Academy", courses);
            var           hqc     = new Course("High Quality Code", students);

            academy.AddCourse(hqc);

            Assert.AreEqual(academy.Courses[4], hqc);
        }
コード例 #19
0
        public void TestAddCourseWithValidCourse()
        {
            
            List<Course> courses = new List<Course>()
            {
                new Course("HTML", this.students),
                new Course("CSS", this.students),
                new Course("C#", this.students),
                new Course("JS", this.students),
            };

            School.School academy = new School.School("Telerik Academy", courses);
            var hqc = new Course("High Quality Code", students);
            academy.AddCourse(hqc);

            Assert.AreEqual(academy.Courses[4], hqc);
        }
コード例 #20
0
        public void TestRemoveCourseWithValidCourse()
        {  
            List<Course> courses = new List<Course>()
            {
                new Course("HTML", this.students),
                new Course("CSS", this.students),
                new Course("C#", this.students),
                new Course("JS", this.students),
            };

            School.School tu = new School.School("TU", courses);
            Course js = new Course("JS Part 2", students);
            
            tu.AddCourse(js);
            tu.RemoveCourse(js);

            Assert.IsFalse(tu.Courses.Contains(js));
        }
コード例 #21
0
        public void TestRemoveCourseWithValidCourse()
        {
            List <Course> courses = new List <Course>()
            {
                new Course("HTML", this.students),
                new Course("CSS", this.students),
                new Course("C#", this.students),
                new Course("JS", this.students),
            };

            School.School tu = new School.School("TU", courses);
            Course        js = new Course("JS Part 2", students);

            tu.AddCourse(js);
            tu.RemoveCourse(js);

            Assert.IsFalse(tu.Courses.Contains(js));
        }
コード例 #22
0
        /// <summary>
        /// Main Method
        /// </summary>
        public static void Main()
        {
            School tmt = new School("TMT");
            Course electricalEngeneering = new Course("Electrical Enceneering");
            for (int i = 0; i < 10; i++)
            {
                electricalEngeneering.JoinCourse(new Student(string.Format("Student{0}", i), tmt.GetStugentId));                    
            }

            tmt.AddCourse(electricalEngeneering);

            ConsolePrinter(tmt.ToString());
            foreach (var course in tmt.ViewCourses())
            {
                ConsolePrinter(course.ToString(), 3);
                foreach (var student in course.ViewStudents())
                {
                    ConsolePrinter(student.Value.ToString(), 6);
                }
            }
        }
コード例 #23
0
 public void AddDuplicatedCourse()
 {
     School school = new School();
     school.AddCourse(new Course("lol"));
     school.AddCourse(new Course("lol"));
 }
コード例 #24
0
 public void AddCourse()
 {
     var school = new School();
     school.AddCourse(new Course(ValidCourseName));
     Assert.AreEqual(ValidCourseName, school.GetCourseByName(ValidCourseName).CourseName);
 }
コード例 #25
0
        public void TestAddExistingCourse()
        {
            List<Course> courses = new List<Course>()
            {
                new Course("HTML", this.students),
                new Course("CSS", this.students),
                new Course("C#", this.students),
                new Course("JS", this.students),
            };

            School.School tu = new School.School("TU", courses);
            Course algo = new Course("Algorithms", students);
            tu.AddCourse(algo);
            tu.AddCourse(algo);
        }
コード例 #26
0
        public void TestAddNullCourse()
        {
            List<Course> courses = new List<Course>()
            {
                new Course("HTML", this.students),
                new Course("CSS", this.students),
                new Course("C#", this.students),
                new Course("JS", this.students),
            };

            School.School tu = new School.School("TU", courses);
            tu.AddCourse(null);
        }
コード例 #27
0
 public void AddCourse()
 {
     School school = new School();
     school.AddCourse(new Course("lol"));
     Assert.AreEqual("lol",school.GetCourseByName("lol").CourseName);
 }
コード例 #28
0
 public void AddCourseWithStudents()
 {
     var school = new School();
     school.AddCourse(ValidCourseName, new Student(ValidName, 10000));
     Assert.AreEqual(ValidCourseName, school.GetCourseByName(ValidCourseName).CourseName);
 }
コード例 #29
0
ファイル: SchoolTests.cs プロジェクト: bahtev/TelerikAcademy
        public void TestSeveralCoursesWithSameName()
        {
            School.School s = new School.School("bar");
            Course c = new Course("Math");
            Course c1 = new Course("alpha");
            Course c2 = new Course("beta");
            Course c3 = new Course("gama");
            Course c4 = new Course("Math");
            Course c5 = new Course("Math");

            s.AddCourse(c);
            s.AddCourse(c1);
            s.AddCourse(c2);
            s.AddCourse(c3);
            s.AddCourse(c4);
            s.AddCourse(c5);

            Course removed = s.RemoveCourse("Math");

            bool result = removed == c;
            result = result && s.Courses[0] == c1 &&
                s.Courses[1] == c2 && s.Courses[2] == c3
                && s.Courses[3] == c4 && s.Courses[4] == c5;

            Assert.IsTrue(result);
        }
コード例 #30
0
ファイル: SchoolTests.cs プロジェクト: bahtev/TelerikAcademy
 public void TestAddingNullCourse()
 {
     School.School s = new School.School("MySchool");
     Course c = null;
     s.AddCourse(c);
 }
コード例 #31
0
 public void TestAddCourse2()
 {
     School school = new School("Telerik");
     school.AddCourse(null);
 }
コード例 #32
0
ファイル: SchoolTests.cs プロジェクト: bahtev/TelerikAcademy
        public void TestRemoveMissingStudent()
        {
            School.School s = new School.School("bar");
            Course c = new Course("Math");
            Course c1 = new Course("alpha");
            Course c2 = new Course("beta");

            s.AddCourse(c);
            s.AddCourse(c1);
            s.AddCourse(c2);

            Course removed = s.RemoveCourse("omega");
            bool result = removed == null;
            result = result && s.Courses[0] == c &&
                s.Courses[1] == c1 && s.Courses[2] == c2;

            Assert.IsTrue(result);
        }
コード例 #33
0
 public void AddCourseWithStudents()
 {
     School school = new School();
     school.AddCourse("lol",  new Student("lele", 10000), new Student("male", 10001));
     Assert.AreEqual("lol", school.GetCourseByName("lol").CourseName);
 }
コード例 #34
0
 public void CanNotAddNullCourse()
 {
     var school = new School();
     school.AddCourse(null);
 }
コード例 #35
0
 public void AddDuplicateCourse()
 {
     var school = new School();
     school.AddCourse(new Course(ValidCourseName));
     school.AddCourse(new Course(ValidCourseName));
 }