public void ServiceGetAllWithAllParametersTest()
        {
            // Arrange
            _Repository.GetAll(Arg.Any <Expression <Func <Dummy, bool> > >(),
                               Arg.Any <Func <IQueryable <Dummy>, IOrderedQueryable <Dummy> > >(),
                               Arg.Any <string>()).Returns(_List.AsQueryable());
            // Act
            var result = _Service.GetAll();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(2, result.Count());
        }
示例#2
0
 /// <summary>
 /// Gets all.
 /// </summary>
 /// <param name="filter">The filter.</param>
 /// <param name="orderBy">The order by.</param>
 /// <param name="includeProperties">The include properties.</param>
 /// <returns></returns>
 public virtual IEnumerable <TEntityDto> GetAll(
     Expression <Func <TEntity, bool> > filter,
     Func <IQueryable <TEntity>, IOrderedQueryable <TEntity> > orderBy,
     string includeProperties)
 {
     return(from item in repository.GetAll(filter, orderBy, includeProperties)
            select serviceMapper.Map <TEntityDto>(item));
 }
 public IEnumerable <TEntityDto> GetAll()
 {
     try
     {
         return(from book in repository.GetAll()
                select Mapper.Map <TEntityDto>(book));
     }catch (Exception ex)
     {
         loggerHelper.Error("Mensaje error", ex);
         return(new List <TEntityDto>());
     }
 }
示例#4
0
 public IEnumerable <TEntityDto> GetAll()
 {
     loggerHelper.LogInfo(GetType().FullName, "Entidad consultada");
     return(from book in repository.GetAll()
            select Mapper.Map <TEntityDto>(book));
 }