public void Create_EmptyCourse_Exception() { var newCourse = new DataPlus.Entities.Models.Course(); var repositoryWrapper = new Mock <IWrapperRepository>(); var courseService = new CourseService(repositoryWrapper.Object, _logger); Assert.Throws <NullReferenceException>(() => courseService.Create(newCourse)); }
public void Create_CourseWithData_NewCourse() { var newCourse = new DataPlus.Entities.Models.Course { Id = new Guid("1340DC3F-7818-4D9A-B7B3-76DE28920134"), Name = "Course 6", Description = "Course 6 is the third course" }; var repositoryWrapper = new Mock <IWrapperRepository>(); repositoryWrapper.Setup(x => x.Course.GetAll()).Returns(_courseList.AsQueryable); var courseService = new CourseService(repositoryWrapper.Object, _logger); var numberOfCourses = courseService.GetAll().Count; courseService.Create(newCourse); }