当前位置: 首页>>代码示例>>C#>>正文


C# Course.RemoveStudent方法代码示例

本文整理汇总了C#中School.Course.RemoveStudent方法的典型用法代码示例。如果您正苦于以下问题:C# Course.RemoveStudent方法的具体用法?C# Course.RemoveStudent怎么用?C# Course.RemoveStudent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在School.Course的用法示例。


在下文中一共展示了Course.RemoveStudent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CourseCanNotRemoveAStudentThatItDoesntHave

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

            course.RemoveStudent(student);
        }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例2: 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

示例3: TestRemoveNotExistingStudent

        public void TestRemoveNotExistingStudent()
        {
            Course css = new Course("CSS", students);
            Student koko = new Student("Kaloyan", 88823);

            css.RemoveStudent(koko);
        }
开发者ID:VyaraGGeorgieva,项目名称:TelerikAcademy,代码行数:7,代码来源:CourseTest.cs

示例4: CourseRemovingAStudentWhoHasntEnrolledInTheCourseShouldThrow

        public void CourseRemovingAStudentWhoHasntEnrolledInTheCourseShouldThrow()
        {
            var course = new Course("course");
            var student = new Student("Captain Blackbeard", 10000);

            course.AddStudent(student);
            course.RemoveStudent(new Student("Captain Nemo", 12000));
        }
开发者ID:tokera,项目名称:Telerik-Academy,代码行数:8,代码来源:TestCourse.cs

示例5: CourseRemovingInvalidStudentShouldThrow

        public void CourseRemovingInvalidStudentShouldThrow()
        {
            var course = new Course("course");
            Student student = null;

            course.AddStudent(new Student("Captain Nemo", 12000));
            course.RemoveStudent(student);
        }
开发者ID:tokera,项目名称:Telerik-Academy,代码行数:8,代码来源:TestCourse.cs

示例6: RemovingNonAddedStudentShouldReturnFalse

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

            var isStudentRemoved = course.RemoveStudent(student);

            Assert.IsFalse(isStudentRemoved);
        }
开发者ID:SimoPrG,项目名称:HighQualityCodeHomework,代码行数:9,代码来源:CourseTests.cs

示例7: LeaveCourse

        public void LeaveCourse(Course course)
        {
            if (course == null)
            {
                throw new ArgumentNullException("course", "Course cannot be null.");
            }

            course.RemoveStudent(this);
        }
开发者ID:ahansb,项目名称:HightQualityCodeHW,代码行数:9,代码来源:Student.cs

示例8: UnsubscribeCourse

        public void UnsubscribeCourse(Course course)
        {
            if (course == null)
            {
                throw new InvalidOperationException("Course can not be null.");
            }

            course.RemoveStudent(this);
        }
开发者ID:Rostech,项目名称:TelerikAcademyHomeworks,代码行数:9,代码来源:Student.cs

示例9: TestRemoveExistingStudent

        public void TestRemoveExistingStudent()
        {
            Course cSharp = new Course("C#", students);
            Student mincho = new Student("Mincho", 23111);
            cSharp.AddStudent(mincho);
            mincho.Name = "isdsds";
            cSharp.RemoveStudent(mincho);

            Assert.AreEqual(students, cSharp.Students);
        }
开发者ID:VyaraGGeorgieva,项目名称:TelerikAcademy,代码行数:10,代码来源:CourseTest.cs

示例10: AddingAndRemovingAStudentShouldMakeStudentCountEqualToZero

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

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

            Assert.AreEqual(0, course.StudentsCount);
        }
开发者ID:SimoPrG,项目名称:HighQualityCodeHomework,代码行数:10,代码来源:CourseTests.cs

示例11: RemovingSomeAddedStudentShouldReturnTrue

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

            course.AddStudent(student);
            var isStudentRemoved = course.RemoveStudent(student);

            Assert.IsTrue(isStudentRemoved);
        }
开发者ID:SimoPrG,项目名称:HighQualityCodeHomework,代码行数:10,代码来源:CourseTests.cs

示例12: TestRemoveStudentsMethodShouldWorkProperly

 public void TestRemoveStudentsMethodShouldWorkProperly()
 {
     var testCourse = new Course("testCourseName");
     var testStudent = new Student(10001, "Test Student Name");
     testCourse.InsertStudent(testStudent);
     testCourse.RemoveStudent(testStudent);
     Assert.IsTrue(
         testCourse.Students.Count == 0,
         "Students list count is not equal to zero"
         );
 }
开发者ID:,项目名称:,代码行数:11,代码来源:

示例13: 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

示例14: Test_CourseStudentsRemoveStudentShouldBeCorect

        public void Test_CourseStudentsRemoveStudentShouldBeCorect()
        {
            var firstName = "Jhon";
            var lastName = "Minkov";
            var studentNumber = 19999;

            var student = new Student(firstName, lastName, studentNumber);
            var course = new Course("CSharp");
            course.AddStudent(student);
            course.RemoveStudent(student);

            Assert.AreEqual(0, course.Students.Count);
        }
开发者ID:VDGone,项目名称:TelerikAcademy-1,代码行数:13,代码来源:SchoolTests.cs

示例15: Main

        public static void Main()
        {
            Student pesho = new Student("Pesho", "Peshev");
            Student gosho = new Student("Gosho", "Goshev");

            Console.WriteLine("Pesho number: {0}; Gosho number: {1}", pesho.UniqueNumber, gosho.UniqueNumber);
            Console.WriteLine("{0}; {1}", pesho.Name, gosho.Name);

            Course math = new Course("Math");
            math.AddStudent(pesho);
            math.AddStudent(gosho);

            Console.WriteLine("Students list count after adding 2 students: " + math.StudentsList.Count);

            math.RemoveStudent(pesho);

            Console.WriteLine("Students list count after removing 1 student: " + math.StudentsList.Count);
            Console.WriteLine(gosho.Courses.Count);
        }
开发者ID:Moiraines,项目名称:TelerikAcademy,代码行数:19,代码来源:StudentsAndCoursesTests.cs


注:本文中的School.Course.RemoveStudent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。