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


C# Course.ToString方法代碼示例

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


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

示例1: AddingStudent_CheckingIfHeExistInCourse

        public void AddingStudent_CheckingIfHeExistInCourse()
        {
            var course = new Course("Course");
            var student = new Student("Petkan");
            course.AddStudent(student);

            var index = course.ToString().IndexOf(student.ToString());
            Assert.IsTrue(index >= 0);
        }
開發者ID:Bvaptsarov,項目名稱:Homework,代碼行數:9,代碼來源:CourseTest.cs

示例2: CheckIfCourseIsRemoved_IfTrue

        public void CheckIfCourseIsRemoved_IfTrue()
        {
            var school = new SchoolDem("A");
            var course = new Course("Breakfast");

            school.AddCourse(course);
            school.RemoveCourse(course);

            Assert.IsTrue((school.ToString().IndexOf(course.ToString()) <= 0));
        }
開發者ID:Bvaptsarov,項目名稱:Homework,代碼行數:10,代碼來源:SchoolTest.cs

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

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

示例5: RemovingCorrectlyStudent_TrueIfRemovedCorrectly

        public void RemovingCorrectlyStudent_TrueIfRemovedCorrectly()
        {
            var spirt = new Course("Spirt");
            var student = new Student("sad");

            spirt.AddStudent(student);
            spirt.RemoveStudentByID(student.UniqueID);

            var index = spirt.ToString().IndexOf(student.ToString());
            Assert.IsTrue(index < 0);
        }
開發者ID:Bvaptsarov,項目名稱:Homework,代碼行數:11,代碼來源:CourseTest.cs

示例6: TestCourseToString2

        public void TestCourseToString2()
        {
            Course course = new Course("Telerik Academy");

            Assert.AreEqual(
                "Course name -> Telerik Academy; Course students -> { No students }",
                course.ToString(),
                "Course.ToString() is not correct.");
        }
開發者ID:niki-funky,項目名稱:Telerik_Academy,代碼行數:9,代碼來源:CourseTest.cs

示例7: TestCourseToString1

        public void TestCourseToString1()
        {
            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.AreEqual(
                string.Format(
                "Course name -> Telerik Academy; Course students -> {{ {0}, \n{1} }}",
                misho,
                pesho),
                course.ToString(),
                "Course.ToString() is not correct.");
        }
開發者ID:niki-funky,項目名稱:Telerik_Academy,代碼行數:16,代碼來源:CourseTest.cs

示例8: TestCourseToString

 public void TestCourseToString()
 {
     Course course = new Course("Software Engineering");
     Assert.AreEqual(course.ToString(), "Software Engineering", "Clone doesn't work correct");
 }
開發者ID:NikolayKostadinov,項目名稱:Homeworks,代碼行數:5,代碼來源:CourseTest.cs


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