當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。