Mock Repository vs. Real Repository w/Mocked Data

Posted by n8wrl on Stack Overflow See other posts from Stack Overflow or by n8wrl
Published on 2010-05-19T14:32:16Z Indexed on 2010/05/19 14:40 UTC
Read the original article Hit count: 387

Filed under:
|
|

I must be doing something fundamentally wrong.

I am implmenting my repositories and then testing them with mocked data. All is well.

Now I want to test my domain objects so I point them at mock repositories.

But I'm finding that I have to re-implement logic from the 'real' repositories into the mocks, or, create 'helper classes' that encapsulate the logic and interact with the repositories (real or mock), and then I have to test those too.

So what am I missing - why implement and test mock repositories when I could use the real ones with mocked data?

EDIT: To clarify, by 'mocked data' I do not hit the actual database. I have a 'DB mock layer' I can insert under the real repositories that returns known-data.

© Stack Overflow or respective owner

Related posts about ddd

Related posts about repository