您如何仅使用最小起订量执行与 Effort 相同的测试?

How can you perform the same tests as Effort using only Moq?

目前,我已经设置了很多测试,包括使用 Effort 的数据访问层和业务逻辑层测试(参见 https://effort.codeplex.com/). We have already been using Moq in our unit tests, and my boss would like to keep things simple, so he wants me to see if I can move the tests over from the Effort implementation to us only Moq and FakeDbSet (see http://aikmeng.com/post/62817541825/how-to-mock-dbcontext-and-dbset-with-moq-for-unit),以使代码库更易于维护。

据我了解,Effort 基本上是在内存中模拟整个 SQL 服务器数据库。因此,似乎需要大量代码使用 Moq 来设置所有内容,以便测试可以 运行 仅使用它。有没有人对此有任何想法?甚至可以在没有大量编码的情况下完成吗?有没有人有什么建议? TIA.

最后留在了 Effort。使用 FakeDbSet 和 Moq 需要更多的设置并导致一些 LINQ 查询在单元测试中失败,即使它们在生产环境中工作也是如此。

更新:

事实证明,这不是 FakeDbSet 或 Moq 的问题——我的 LINQ 查询中存在问题,如果存在空字符串值,它将失败。