本文整理汇总了C#中School.Student.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Student.ToString方法的具体用法?C# Student.ToString怎么用?C# Student.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类School.Student
的用法示例。
在下文中一共展示了Student.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
//Students
Student firstStudent = new Student("Pesho", "Kamburov", 1);
Student secondStudent = new Student("Galin", "Imamov", 2);
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Students:");
Console.ResetColor();
Console.WriteLine(firstStudent.ToString());
Console.WriteLine(secondStudent.ToString());
//Teachers
Teacher firstTeacher = new Teacher("Stefan", "Popov");
firstTeacher.AddDiscipline(new Discipline("Math", 16, 10));
firstTeacher.AddDiscipline(new Discipline("Physics", 20, 5));
Teacher secondTeacher = new Teacher("Armin", "Van Buuren");
secondTeacher.AddDiscipline(new Discipline("TechMusic", 15, 5));
secondTeacher.AddDiscipline(new Discipline("Minimal", 18, 7));
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("\nTeachers:");
Console.ResetColor();
Console.WriteLine(firstTeacher.ToString());
Console.WriteLine(secondTeacher.ToString());
//School
School school = new School();
school.AddClass(new Class("12b", firstTeacher));
school.AddClass(new Class("12a", secondTeacher));
}
示例2: CompareToString
public void CompareToString()
{
var student = new Student("Marmalad Palachinkov");
Assert.AreEqual("Marmalad Palachinkov - " + student.UniqueID, student.ToString(),
"ToString is not returning in correct format.");
}
示例3: StudentToStringTest
public void StudentToStringTest()
{
var student = new Student("Pesho", 12345);
string expected = "Student name is: Pesho, with id: 12345";
string actual = student.ToString();
Assert.AreEqual(expected, actual);
}
示例4: 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);
}
示例5: Main
public static void Main()
{
Student dwayne = new Student("Pesho", "Peshov", 6);
Console.WriteLine("Student name: {0}, Class number: {1}", dwayne.ToString(), dwayne.ClassNumber);
Teacher firstTeacher = new Teacher(
"Ivan",
"Petkov",
new Discipline("Math", 15, 20),
new Discipline("Art", 10, 12));
Console.WriteLine(firstTeacher.ToString());
Teacher secondTeacher = new Teacher(
"The",
"Rock",
new Discipline("Sports", 30, 40));
School newSchool = new School(
new Class("12a", firstTeacher),
new Class("12b", secondTeacher));
}
示例6: 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);
}
示例7: TestStudentToString
public void TestStudentToString()
{
Student misho = new Student("Misho Ivanov");
Assert.AreEqual(
string.Format("(Name = Misho Ivanov, UN = {0})", misho.Number),
misho.ToString(),
"Student.ToString() does not work correctly.");
}
示例8: TestStudentTostring
public void TestStudentTostring()
{
Student student = new Student("Nikolay Kostadinov",10000);
Assert.AreEqual(student.ToString(), "10000; Nikolay Kostadinov", "Invalid String");
}