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


Question

Presently, I have setup a lot of tests including data access layer and business logic layer tests using Effort (see 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), to make the code base simpler to maintain.

From what I understand, Effort basically mimics an entire SQL Server database in memory. So it seems like it would take a lot of code using Moq to set everything up so that a test can be run using only that. Does anyone have any thoughts on this? Can it even be done without a huge amount of coding? Does anyone have any suggestions? TIA.

Accepted Answer

Ended up staying with Effort. Using FakeDbSet and Moq required a lot more setup and caused some LINQ queries to fail in the unit tests even though they work in a production situation.

UPDATE:

It turns out that it was not a problem with FakeDbSet or Moq--there were problems in my LINQ query where it would fail if there were null string values.





Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why