如何使用moq模拟具有Func参数的泛型

时间:2017-06-16 20:55:17

标签: c# unit-testing generics moq

我有一个方法,我想测试通用存储库:

public virtual async Task<IEnumerable<TEntity>> GetAllAsync<TEntity>(
            Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
            string includeProperties = null,
            int? skip = null,
            int? take = null)
            where TEntity : class, IEntity
        {
            return await GetQueryable<TEntity>(null, orderBy, includeProperties, skip, take).ToListAsync();
        }

我无法用moq嘲笑这个。

0 个答案:

没有答案