本文整理汇总了C#中School.Course.RemoveStudent方法的典型用法代码示例。如果您正苦于以下问题:C# Course.RemoveStudent方法的具体用法?C# Course.RemoveStudent怎么用?C# Course.RemoveStudent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类School.Course
的用法示例。
在下文中一共展示了Course.RemoveStudent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CourseCanNotRemoveAStudentThatItDoesntHave
public void CourseCanNotRemoveAStudentThatItDoesntHave()
{
var course = new Course("math");
var student = new Student("Pesho", 12345);
course.RemoveStudent(student);
}
示例2: 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);
}
}
示例3: TestRemoveNotExistingStudent
public void TestRemoveNotExistingStudent()
{
Course css = new Course("CSS", students);
Student koko = new Student("Kaloyan", 88823);
css.RemoveStudent(koko);
}
示例4: CourseRemovingAStudentWhoHasntEnrolledInTheCourseShouldThrow
public void CourseRemovingAStudentWhoHasntEnrolledInTheCourseShouldThrow()
{
var course = new Course("course");
var student = new Student("Captain Blackbeard", 10000);
course.AddStudent(student);
course.RemoveStudent(new Student("Captain Nemo", 12000));
}
示例5: CourseRemovingInvalidStudentShouldThrow
public void CourseRemovingInvalidStudentShouldThrow()
{
var course = new Course("course");
Student student = null;
course.AddStudent(new Student("Captain Nemo", 12000));
course.RemoveStudent(student);
}
示例6: RemovingNonAddedStudentShouldReturnFalse
public void RemovingNonAddedStudentShouldReturnFalse()
{
var student = new Student("Pesho");
var course = new Course();
var isStudentRemoved = course.RemoveStudent(student);
Assert.IsFalse(isStudentRemoved);
}
示例7: LeaveCourse
public void LeaveCourse(Course course)
{
if (course == null)
{
throw new ArgumentNullException("course", "Course cannot be null.");
}
course.RemoveStudent(this);
}
示例8: UnsubscribeCourse
public void UnsubscribeCourse(Course course)
{
if (course == null)
{
throw new InvalidOperationException("Course can not be null.");
}
course.RemoveStudent(this);
}
示例9: TestRemoveExistingStudent
public void TestRemoveExistingStudent()
{
Course cSharp = new Course("C#", students);
Student mincho = new Student("Mincho", 23111);
cSharp.AddStudent(mincho);
mincho.Name = "isdsds";
cSharp.RemoveStudent(mincho);
Assert.AreEqual(students, cSharp.Students);
}
示例10: AddingAndRemovingAStudentShouldMakeStudentCountEqualToZero
public void AddingAndRemovingAStudentShouldMakeStudentCountEqualToZero()
{
var student = new Student("Pesho");
var course = new Course();
course.AddStudent(student);
course.RemoveStudent(student);
Assert.AreEqual(0, course.StudentsCount);
}
示例11: RemovingSomeAddedStudentShouldReturnTrue
public void RemovingSomeAddedStudentShouldReturnTrue()
{
var student = new Student("Pesho");
var course = new Course();
course.AddStudent(student);
var isStudentRemoved = course.RemoveStudent(student);
Assert.IsTrue(isStudentRemoved);
}
示例12: TestRemoveStudentsMethodShouldWorkProperly
public void TestRemoveStudentsMethodShouldWorkProperly()
{
var testCourse = new Course("testCourseName");
var testStudent = new Student(10001, "Test Student Name");
testCourse.InsertStudent(testStudent);
testCourse.RemoveStudent(testStudent);
Assert.IsTrue(
testCourse.Students.Count == 0,
"Students list count is not equal to zero"
);
}
示例13: 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);
}
示例14: Test_CourseStudentsRemoveStudentShouldBeCorect
public void Test_CourseStudentsRemoveStudentShouldBeCorect()
{
var firstName = "Jhon";
var lastName = "Minkov";
var studentNumber = 19999;
var student = new Student(firstName, lastName, studentNumber);
var course = new Course("CSharp");
course.AddStudent(student);
course.RemoveStudent(student);
Assert.AreEqual(0, course.Students.Count);
}
示例15: Main
public static void Main()
{
Student pesho = new Student("Pesho", "Peshev");
Student gosho = new Student("Gosho", "Goshev");
Console.WriteLine("Pesho number: {0}; Gosho number: {1}", pesho.UniqueNumber, gosho.UniqueNumber);
Console.WriteLine("{0}; {1}", pesho.Name, gosho.Name);
Course math = new Course("Math");
math.AddStudent(pesho);
math.AddStudent(gosho);
Console.WriteLine("Students list count after adding 2 students: " + math.StudentsList.Count);
math.RemoveStudent(pesho);
Console.WriteLine("Students list count after removing 1 student: " + math.StudentsList.Count);
Console.WriteLine(gosho.Courses.Count);
}