public void ShouldGetListWithFindAllMethod()
        {
            Mock <IGenericRepository <ExamProgram> > examProgramRepositoryMock = new Mock <IGenericRepository <ExamProgram> >();
            Mock <IActivityLoggerService>            activityLoggerMock        = new Mock <IActivityLoggerService>();

            IEnumerable <ExamProgram> testData = new List <ExamProgram>()
            {
                new ExamProgram()
                {
                    Id        = 0,
                    EndDate   = System.DateTime.Now.AddYears(1),
                    StartDate = System.DateTime.Now
                },
                new ExamProgram()
                {
                    Id        = 1,
                    EndDate   = System.DateTime.Now.AddYears(2),
                    StartDate = System.DateTime.Now.AddYears(1)
                }
            };

            examProgramRepositoryMock.Setup((e) => e.FindAll(null, 0, 0)).Returns(testData.AsQueryable());

            IGenericService <ExamProgram> examProgramService = new GenericService <ExamProgram>(examProgramRepositoryMock.Object, activityLoggerMock.Object);

            List <ExamProgram> result = examProgramService.FindAll().ToList();

            Assert.Equal(2, result.Count());
            Assert.Equal(0, result[0].Id);
            Assert.Equal(1, result[1].Id);
        }
Exemple #2
0
 public virtual List <T> FindAll()
 {
     return(services.FindAll());
 }