本文整理汇总了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);
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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.");
}
示例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.");
}
示例8: TestCourseToString
public void TestCourseToString()
{
Course course = new Course("Software Engineering");
Assert.AreEqual(course.ToString(), "Software Engineering", "Clone doesn't work correct");
}