public void FindCourse_ShouldThrowExceptionIfCourseNotExist() { var coursesRepoBuilder = new CoursesRepositoryBuilder(); var courseRepo = coursesRepoBuilder .WithAll() .Build(); var sut = new CoursesService(null, courseRepo, null, Mapper); var ex = Assert.Throws <ArgumentException>(() => sut.FindCourse("10")); Assert.Equal("You can not edit this page", ex.Message); }
public void FindCourse_ShouldWork_CorrectlyAndReturn_EditCourseViewModel() { var coursesRepoBuilder = new CoursesRepositoryBuilder(); var courseRepo = coursesRepoBuilder .WithAll() .Build(); var sut = new CoursesService(null, courseRepo, null, Mapper); var actual = sut.FindCourse("3"); Assert.IsType <EditCourseViewModel>(actual); Assert.Equal("3", actual.Id); }