public void ThrowInvalidOperationException_WhenPassedCourseDoesNotExistInSchoolCourses() { // Arrange string validName = "Vasil Levski"; var schoolFake = new SchoolFake(validName); var existingCourseStub = new Mock <ICourse>().Object; var nonexistingCourseStub = new Mock <ICourse>().Object; schoolFake.ExposedCourses = new List <ICourse> { existingCourseStub }; // Act and Assert Assert.ThrowsException <InvalidOperationException>(() => schoolFake.RemoveCourse(nonexistingCourseStub)); }
public void RemovePassedCourseFromCourses_WhenCourseExists() { // Arrange string validName = "Vasil Levski"; var schoolFake = new SchoolFake(validName); int expectedCoursesCount = 1; var courseOneStub = new Mock <ICourse>().Object; var courseTwoStub = new Mock <ICourse>().Object; schoolFake.ExposedCourses = new List <ICourse> { courseOneStub, courseTwoStub }; // Act schoolFake.RemoveCourse(courseOneStub); // Assert Assert.AreEqual(expectedCoursesCount, schoolFake.Courses.Count); }