当前位置: 首页>>代码示例>>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;未经允许,请勿转载。