public void GetCourseList_WhenCalledWithValidArguments_ReturnsANonEmptyArray() { IPrepareCoursesForInput prepareCoursesForInput = Substitute.For <IPrepareCoursesForInput>(); prepareCoursesForInput.When(p => p.GetCourseList()).Do(context => { throw new Exception("fake exception"); }); Assert.Throws <Exception>(() => prepareCoursesForInput.GetCourseList()); }
public void GetAllCoursesAndTheirPrerequisites_WhenCalled_ReturnsANonEmptyArray() { IPrepareCoursesForInput prepareCoursesForInput = Substitute.For <IPrepareCoursesForInput>(); prepareCoursesForInput.When(p => p.GetAllCoursesAndTheirPrerequisites()).Do(context => { throw new Exception("fake exception"); }); Assert.Throws <Exception>(() => prepareCoursesForInput.GetAllCoursesAndTheirPrerequisites()); }
public void PrepareCourses_WhenCalled_ChangesAllCoursesStringArray() { IPrepareCoursesForInput prepareCoursesForInput = Substitute.For <IPrepareCoursesForInput>(); string[] testCourses = { "Intro to Arguing on the Internet: Godwin’s Law", "Understanding Circular Logic: Intro to Arguing on the Internet" }; prepareCoursesForInput.When(p => p.PrepareCourses(testCourses)).Do(context => { throw new Exception("fake exception"); }); Assert.Throws <Exception>(() => prepareCoursesForInput.PrepareCourses(testCourses)); }