public void ShouldGetOneItemWithFindByIdMethod() { Mock <IGenericRepository <ExamProgram> > examProgramRepositoryMock = new Mock <IGenericRepository <ExamProgram> >(); Mock <IActivityLoggerService> activityLoggerMock = new Mock <IActivityLoggerService>(); examProgramRepositoryMock.Setup((e) => e.FindById("10", null)).Returns(new ExamProgram() { Id = 10, EndDate = System.DateTime.Now.AddYears(1), StartDate = System.DateTime.Now, Courses = new List <Course>() }); IGenericService <ExamProgram> ExamProgramService = new GenericService <ExamProgram>(examProgramRepositoryMock.Object, activityLoggerMock.Object); ExamProgram result = ExamProgramService.FindById("10"); Assert.NotNull(result); Assert.Equal(10, result.Id); }
public virtual T FindById(int id) { return(services.FindById(id)); }
public virtual void FindById(int id) { service.FindById(id); }