本文整理汇总了C#中Student.JoinCourse方法的典型用法代码示例。如果您正苦于以下问题:C# Student.JoinCourse方法的具体用法?C# Student.JoinCourse怎么用?C# Student.JoinCourse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Student
的用法示例。
在下文中一共展示了Student.JoinCourse方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Student_JoinCourse_ShouldJoinStudentCorrectly
public void Student_JoinCourse_ShouldJoinStudentCorrectly()
{
var student = new Student("Anna Mariq", 7777);
var course = new Course();
student.JoinCourse(course);
Assert.AreEqual(1, course.Students.Count);
}
示例2: JoinCourse_ShouldAddStudentToGivenCourseCorrectly
public void JoinCourse_ShouldAddStudentToGivenCourseCorrectly()
{
var name = "Ivan";
var uniqueNumber = 12345;
var student = new Student(name, uniqueNumber);
var course = new Course();
student.JoinCourse(course);
Assert.AreEqual(1, course.Students.Count);
}
示例3: LeaveCourse_ShouldRemoveStudent_WhenHeDecidesToLeave
public void LeaveCourse_ShouldRemoveStudent_WhenHeDecidesToLeave()
{
var name = "Ivan";
var uniqueNumber = 12345;
var student = new Student(name, uniqueNumber);
var course = new Course();
student.JoinCourse(course);
student.LeaveCourse(course);
Assert.AreEqual(0, course.Students.Count);
}
示例4: StudentWithValidNamesAndIDShouldThrowAnExceptionWhenJoiningCourseThatIsNull
public void StudentWithValidNamesAndIDShouldThrowAnExceptionWhenJoiningCourseThatIsNull()
{
var student = new Student("Georgi", "Georgiev", 20000);
Course course = null;
student.JoinCourse(course);
}
示例5: StudentWithValidNamesAndIDShouldNotThrowAnExceptionWhenLeavingValidCourse
public void StudentWithValidNamesAndIDShouldNotThrowAnExceptionWhenLeavingValidCourse()
{
var student = new Student("Georgi", "Georgiev", 20000);
var course = new Course("CSharp");
student.JoinCourse(course);
student.LeaveCourse(course);
}
示例6: Student_JoinNullCourse_ShouldThrowArgumentNullException
public void Student_JoinNullCourse_ShouldThrowArgumentNullException()
{
var student = new Student("Anna Mariq", 7777);
Course course = null;
student.JoinCourse(course);
}