本文整理汇总了C#中School.AddCourse方法的典型用法代码示例。如果您正苦于以下问题:C# School.AddCourse方法的具体用法?C# School.AddCourse怎么用?C# School.AddCourse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类School
的用法示例。
在下文中一共展示了School.AddCourse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddingCourseThatAlreadyExistsShouldThrow
public void AddingCourseThatAlreadyExistsShouldThrow()
{
School school = new School("Hogwards");
Course course = new Course("BatCourse");
school.AddCourse(course);
school.AddCourse(course);
}
示例2: AddTheSameCourse_AddTheSameCourseInShool_ShouldThrowNullException
public void AddTheSameCourse_AddTheSameCourseInShool_ShouldThrowNullException()
{
var school = new School("HR.Smirnenski");
var course = new Course();
school.AddCourse(course);
school.AddCourse(course);
}
示例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: SchoolShouldThrowWhenAddedCourseAlreadyExists
public void SchoolShouldThrowWhenAddedCourseAlreadyExists()
{
School telerikAcademy = new School("TelerikAcademy");
Course highQualityCode = new Course("High quality code");
telerikAcademy.AddCourse(highQualityCode);
telerikAcademy.AddCourse(highQualityCode);
}
示例5: NewCourseToAddShouldThrownAnExceptionIfAlreadyExists
public void NewCourseToAddShouldThrownAnExceptionIfAlreadyExists()
{
var school = new School("Telerik");
var course = new Course("Math");
school.AddCourse(course);
school.AddCourse(course);
}
示例6: AddingCourseWithExistingNameShouldThrow
public void AddingCourseWithExistingNameShouldThrow()
{
var school = new School("Greendale");
var courseOne = new Course("Diving");
school.AddCourse(courseOne);
var courseTwo = new Course("Diving");
school.AddCourse(courseTwo);
}
示例7: EnsureCourseCanBeAddedToSchollMoreThanOnce
public void EnsureCourseCanBeAddedToSchollMoreThanOnce()
{
int number = 1;
string name = "C#";
Course course = new Course(name, number);
School school = new School();
school.AddCourse(course);
school.AddCourse(course);
}
示例8: TestAddCourse
public void TestAddCourse()
{
Course php = new Course("PHP");
Course js = new Course("Java Script");
School mySchool = new School();
mySchool.AddCourse(php);
mySchool.AddCourse(js);
Assert.AreEqual(mySchool.Courses.Count, 2);
Assert.AreEqual(mySchool.Courses[1].Name, "Java Script");
}
示例9: AddingCourseShouldCorrectlyAddCourseToTheSchool
public void AddingCourseShouldCorrectlyAddCourseToTheSchool()
{
var school = new School();
var course = new Course("What the hell!");
school.AddCourse(course);
Assert.AreEqual(1, school.Courses.Count, "School courses is not added properly!");
}
示例10: SchoolShouldAddCourseCorrectly
public void SchoolShouldAddCourseCorrectly()
{
var school = new School("Yane Sandanski");
var course = new Course("Music");
school.AddCourse(course);
Assert.AreSame(course, school.Courses.First());
}
示例11: Test_SchoolShouldAddCourseCorrectly
public void Test_SchoolShouldAddCourseCorrectly()
{
var school = new School("Telerik");
var course = new Course("Java Script");
school.AddCourse(course);
}
示例12: SchoolShouldNotThrowAnExceptionWhenAddingValidCourse
public void SchoolShouldNotThrowAnExceptionWhenAddingValidCourse()
{
var school = new School("School");
var course = new Course("CSharp");
school.AddCourse(course);
}
示例13: AddingNewCourseShouldWorkCorrectly
public void AddingNewCourseShouldWorkCorrectly()
{
var school = new School("Greendale");
var course = new Course("Grifting");
school.AddCourse(course);
Assert.AreSame(course, school.Courses.First());
}
示例14: AddingNewCourseShoudProperlyWork
public void AddingNewCourseShoudProperlyWork()
{
var school = new School();
school.AddCourse(new Course());
Assert.AreEqual(1, school.Courses.Count);
}
示例15: RemoveNullCourse_RemoveNullCourseFromShool_ShouldThrowArgumentNullException
public void RemoveNullCourse_RemoveNullCourseFromShool_ShouldThrowArgumentNullException()
{
var school = new School("HR.Smirnenski");
Course course = null;
school.AddCourse(course);
school.RemoveCourse(course);
}