tags:

views:

26

answers:

2

when I use moq for my database factory, do I need to moq ALL the methods or just the ones that will be called?

or is that the beauty of using moq, where I just have to add moq methods for the ones I will use?

+1  A: 

Just the ones you use.

This applies to most, if not all mocking/faking frameworks.

Anderson Imes
+1  A: 

You don't even have to mock all of the methods that will be called, only the ones that have to return something or that you want confirmation that it was called.

Randolpho
Though be careful that in general, the "confirmation that it was called" bit should be done as the last part of your AAA triumvirate - the Assert section (in some cases if you both need it to be called and need to set up a return value, you might need to 'mentiohn' it twice. (@Randolpho: Feel free to edit this in if you consider it relevant)
Ruben Bartelink