This question already has an answer here:
I understand that you're not actually supposed to hit the database or disk when doing unit tests... Why is that?
Also, taking something like Moq, what is it actually supposed to mock and where? For example, let's say I want to create a method called "loadconfig" that loads an XML document. This would be a void method, so I would check that it has worked by writing tests around the get/set value methods...
So is Moq supposed to mimick a file being loaded? And I'm also to mock returning/setting values? I can see that Moq has assert methods, should these be used in the test method (seems unlikely since the document is stored in a private property)? If its supposed to be used in the get/set methods, then they must return a Boolean instead of the actual value - which means at some point the whole method would need to be changed?
Lastly, at some point you would surely need to remove all the Moq stuff and replace it with a real implementation? But then doesn't that mean the unit tests couldn't or shouldn't be used?