The other day I was reading a little about Unit Testing and I saw some examples where people create a repository interface (i.e. IExampleRepository
) and then create the real repository (public class ExampleRepository : IExampleRepository
) and a repository to be used for unit testing (FakeExampleRepository : IExampleRepository
).
In the IExampleRepository
they were implementing the same methods as in the ExampleRepository
, however with different Linq queries.
What is exactly the objective here? I thought one part of unit testing your code is make sure that a method works correctly? But when I use two totally different queries, one for 'real' and one in the test, how much sense does the test make?