【发布时间】:2013-01-13 09:13:55
【问题描述】:
我的存储库中有以下方法
public IQueryable<T> QueryWithInclude(String include)
{
return _dbSet.Include(include);
}
如何模拟我正在使用 Moq 的这种方法。我似乎找不到正确的方法。
例如我可以为
public IQueryable<T> Query()
{
return _dbSet;
}
mockrepository.Setup(_ => _.Query()).Returns(foo.AsQueryable());
另外,如果模拟这种方法最终变得很困难,那么考虑替代实现/变通方法是否明智?
【问题讨论】:
标签: c# unit-testing nunit moq