當前位置: 首頁>>代碼示例>>C#>>正文


C# Course.AddStudent方法代碼示例

本文整理匯總了C#中School.Course.AddStudent方法的典型用法代碼示例。如果您正苦於以下問題:C# Course.AddStudent方法的具體用法?C# Course.AddStudent怎麽用?C# Course.AddStudent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在School.Course的用法示例。


在下文中一共展示了Course.AddStudent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RemoveStudentInCourse

 public void RemoveStudentInCourse()
 {
     Course course = new Course("lala");
     course.AddStudent(new Student("lol", 10000));
     course.RemoveStudentByUID(10000);
     course.AddStudent(new Student("lol", 10000));
 }
開發者ID:Dyno1990,項目名稱:TelerikAcademy-1,代碼行數:7,代碼來源:CourseTests.cs

示例2: AddingTheSameStudentMoreThanOnce_ThrowException

 public void AddingTheSameStudentMoreThanOnce_ThrowException()
 {
     var spirt = new Course("Spirt");
     var student = new Student("Peter");
     spirt.AddStudent(student);
     spirt.AddStudent(student);
 }
開發者ID:Bvaptsarov,項目名稱:Homework,代碼行數:7,代碼來源:CourseTest.cs

示例3: Main

        private static void Main()
        {
            try
            {
                Student pesho = new Student("Pesho Georgiev");
                Student gosho = new Student("Gosho Ivanov");
                Student misho = new Student("Misho Cekov");
                Student sasho = new Student("Sasho Kostov");

                Course telerikAcademy = new Course("Telerik Academy");
                Course webProgramming = new Course("Web Programming");

                webProgramming.AddStudent(sasho);

                telerikAcademy.AddStudent(pesho);
                telerikAcademy.AddStudent(gosho);
                telerikAcademy.AddStudent(misho);

                telerikAcademy.RemoveStudent(gosho);
                Console.WriteLine(gosho.ToString() + " was removed from course.");

                Console.WriteLine("Courses:");
                Console.WriteLine(telerikAcademy);

                School freeSchool = new School("School of Computer Sciences");
                freeSchool.AddCourse(webProgramming);
                freeSchool.AddCourse(telerikAcademy);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
開發者ID:niki-funky,項目名稱:Telerik_Academy,代碼行數:33,代碼來源:Demo.cs

示例4: AddStudentTwiseTest

 public void AddStudentTwiseTest()
 {
     Course course = new Course("Math");
     Student student = new Student("Gosho", "Ivanov", 12345);
     course.AddStudent(student);
     course.AddStudent(student);
 }
開發者ID:GStoykov,項目名稱:TelerikAcademyHomeworks,代碼行數:7,代碼來源:CourseTest.cs

示例5: TestAddStudentException

 public void TestAddStudentException()
 {
     Course html = new Course("HTML", students);
     Student pesho = new Student("Peter", 29345);
     Student gosho = new Student("Georgi", 99922);
     html.AddStudent(pesho);
     html.AddStudent(gosho);
 }
開發者ID:VyaraGGeorgieva,項目名稱:TelerikAcademy,代碼行數:8,代碼來源:CourseTest.cs

示例6: CourseCanNotContainAStudentMoreThanOnce

        public void CourseCanNotContainAStudentMoreThanOnce()
        {
            var course = new Course("math");
            var student = new Student("Pesho", 12345);

            course.AddStudent(student);
            course.AddStudent(student);
        }
開發者ID:,項目名稱:,代碼行數:8,代碼來源:

示例7: CourseAddingAnAlreadyExistingStudentShouldThrow

        public void CourseAddingAnAlreadyExistingStudentShouldThrow()
        {
            var course = new Course("Just a course");
            var student = new Student("Captain Nemo", 12000);

            course.AddStudent(student);
            course.AddStudent(student);
        }
開發者ID:tokera,項目名稱:Telerik-Academy,代碼行數:8,代碼來源:TestCourse.cs

示例8: TestAddStudent4

 public void TestAddStudent4()
 {
     Course course = new Course("Telerik Academy");
     Student misho = new Student("Misho Ivanov");
     Student pesho = new Student("Pesho Ivanov");
     course.AddStudent(misho);
     course.AddStudent(pesho);
     Assert.IsTrue(course.ListOfStudents.Count == 2);
 }
開發者ID:niki-funky,項目名稱:Telerik_Academy,代碼行數:9,代碼來源:CourseTest.cs

示例9: TestAddStudent2

 public void TestAddStudent2()
 {
     Course course = new Course("Telerik Academy");
     Student misho = new Student("Misho Ivanov");
     Student pesho = new Student("Pesho Ivanov");
     pesho.Number = misho.Number;
     course.AddStudent(misho);
     course.AddStudent(pesho);
 }
開發者ID:niki-funky,項目名稱:Telerik_Academy,代碼行數:9,代碼來源:CourseTest.cs

示例10: AddingOneStudentTwiceShouldMakeCourseHaveOnlyOneStudent

        public void AddingOneStudentTwiceShouldMakeCourseHaveOnlyOneStudent()
        {
            var student = new Student("Pesho");
            var course = new Course();

            course.AddStudent(student);
            course.AddStudent(student);

            Assert.AreEqual(1, course.StudentsCount);
        }
開發者ID:SimoPrG,項目名稱:HighQualityCodeHomework,代碼行數:10,代碼來源:CourseTests.cs

示例11: CourseAddingMoreThanThirtyStudentsShouldThrow

        public void CourseAddingMoreThanThirtyStudentsShouldThrow()
        {
            var course = new Course("1337 sP33cH Course");
            for (int i = 0; i < 30; i++)
            {
                course.AddStudent(new Student(string.Format("Robot P" + i + "esho" + i), 13337 + i));
            }

            course.AddStudent(new Student("Cptn Nemo", 10001));
        }
開發者ID:tokera,項目名稱:Telerik-Academy,代碼行數:10,代碼來源:TestCourse.cs

示例12: CourseToStringTest

 public void CourseToStringTest()
 {
     var course = new Course("C# HQC");
     var pesho = new Student("Pesho", 10132);
     var gosho = new Student("Gosho", 10123);
     course.AddStudent(pesho);
     course.AddStudent(gosho);
     string expected = "Course name: C# HQC\nStudent name is: Pesho, with id: 10132\nStudent name is: Gosho, with id: 10123\n";
     string actual = course.ToString();
     Assert.AreEqual(expected, actual);
 }
開發者ID:slop3n,項目名稱:TelerikAcademy,代碼行數:11,代碼來源:CourseTest.cs

示例13: AddStudentTestThirtyOneStudents

        public void AddStudentTestThirtyOneStudents()
        {
            List<Student> studentList = new List<Student>();
            Course courseThirtyOneStudents = new Course(studentList);
            for (int i = 0; i < 30; i++)
            {
                courseThirtyOneStudents.AddStudent(new Student("Pesho", 10000 + i));
            }

            Student studentPesho = new Student("Pesho", 10031);
            courseThirtyOneStudents.AddStudent(studentPesho);
        }
開發者ID:RobinJS,項目名稱:dotNET,代碼行數:12,代碼來源:CourseTest.cs

示例14: CourseRemoveStudentTest

 public void CourseRemoveStudentTest()
 {
     var course = new Course("Javascript");
     var pesho = new Student("Pesho", 10131);
     var gosho = new Student("Gosho", 10132);
     course.AddStudent(pesho);
     course.AddStudent(gosho);
     course.RemoveStudent(gosho);
     var actual = course.ToString();
     var expected = "Course name: Javascript\nStudent name is: Pesho, with id: 10131\n";
     Assert.AreEqual(expected, actual);
 }
開發者ID:slop3n,項目名稱:TelerikAcademy,代碼行數:12,代碼來源:CourseTest.cs

示例15: AddExistingStudentToCourse

        public void AddExistingStudentToCourse()
        {
            Course math = new Course("Math");
            testingSchool.AddCourse(math);
            testingCourses.Add(math);

            this.testingStudents.Add(new Student("Pesho", 10000));

            testingStudents[0].AddCourse(math);
            math.AddStudent(testingStudents[0]);
            math.AddStudent(testingStudents[0]);
        }
開發者ID:NikolaNikushev,項目名稱:Lectures,代碼行數:12,代碼來源:StudentTest.cs


注:本文中的School.Course.AddStudent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。