本文整理汇总了C#中School.Course.AddStudent方法的典型用法代码示例。如果您正苦于以下问题:C# Course.AddStudent方法的具体用法?C# Course.AddStudent怎么用?C# Course.AddStudent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类School.Course
的用法示例。
在下文中一共展示了Course.AddStudent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveStudentInCourse
public void RemoveStudentInCourse()
{
Course course = new Course("lala");
course.AddStudent(new Student("lol", 10000));
course.RemoveStudentByUID(10000);
course.AddStudent(new Student("lol", 10000));
}
示例2: AddingTheSameStudentMoreThanOnce_ThrowException
public void AddingTheSameStudentMoreThanOnce_ThrowException()
{
var spirt = new Course("Spirt");
var student = new Student("Peter");
spirt.AddStudent(student);
spirt.AddStudent(student);
}
示例3: 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);
}
}
示例4: AddStudentTwiseTest
public void AddStudentTwiseTest()
{
Course course = new Course("Math");
Student student = new Student("Gosho", "Ivanov", 12345);
course.AddStudent(student);
course.AddStudent(student);
}
示例5: TestAddStudentException
public void TestAddStudentException()
{
Course html = new Course("HTML", students);
Student pesho = new Student("Peter", 29345);
Student gosho = new Student("Georgi", 99922);
html.AddStudent(pesho);
html.AddStudent(gosho);
}
示例6: CourseCanNotContainAStudentMoreThanOnce
public void CourseCanNotContainAStudentMoreThanOnce()
{
var course = new Course("math");
var student = new Student("Pesho", 12345);
course.AddStudent(student);
course.AddStudent(student);
}
示例7: CourseAddingAnAlreadyExistingStudentShouldThrow
public void CourseAddingAnAlreadyExistingStudentShouldThrow()
{
var course = new Course("Just a course");
var student = new Student("Captain Nemo", 12000);
course.AddStudent(student);
course.AddStudent(student);
}
示例8: TestAddStudent4
public void TestAddStudent4()
{
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.IsTrue(course.ListOfStudents.Count == 2);
}
示例9: TestAddStudent2
public void TestAddStudent2()
{
Course course = new Course("Telerik Academy");
Student misho = new Student("Misho Ivanov");
Student pesho = new Student("Pesho Ivanov");
pesho.Number = misho.Number;
course.AddStudent(misho);
course.AddStudent(pesho);
}
示例10: AddingOneStudentTwiceShouldMakeCourseHaveOnlyOneStudent
public void AddingOneStudentTwiceShouldMakeCourseHaveOnlyOneStudent()
{
var student = new Student("Pesho");
var course = new Course();
course.AddStudent(student);
course.AddStudent(student);
Assert.AreEqual(1, course.StudentsCount);
}
示例11: CourseAddingMoreThanThirtyStudentsShouldThrow
public void CourseAddingMoreThanThirtyStudentsShouldThrow()
{
var course = new Course("1337 sP33cH Course");
for (int i = 0; i < 30; i++)
{
course.AddStudent(new Student(string.Format("Robot P" + i + "esho" + i), 13337 + i));
}
course.AddStudent(new Student("Cptn Nemo", 10001));
}
示例12: 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);
}
示例13: AddStudentTestThirtyOneStudents
public void AddStudentTestThirtyOneStudents()
{
List<Student> studentList = new List<Student>();
Course courseThirtyOneStudents = new Course(studentList);
for (int i = 0; i < 30; i++)
{
courseThirtyOneStudents.AddStudent(new Student("Pesho", 10000 + i));
}
Student studentPesho = new Student("Pesho", 10031);
courseThirtyOneStudents.AddStudent(studentPesho);
}
示例14: 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);
}
示例15: AddExistingStudentToCourse
public void AddExistingStudentToCourse()
{
Course math = new Course("Math");
testingSchool.AddCourse(math);
testingCourses.Add(math);
this.testingStudents.Add(new Student("Pesho", 10000));
testingStudents[0].AddCourse(math);
math.AddStudent(testingStudents[0]);
math.AddStudent(testingStudents[0]);
}