In .net, unlike in Java, methods are not virtual by default. In order to use most mock object frameworks, you either have to mark the methods that you want to use on your mock as virtual on the `real’ object, or you have to have an interface that you can mock that the class under test will accept in lieu of the implementation.
It seems like bad form to go and mark every method as virtual, but it also seems like bad form to define an interface for every single class.
What is the best thing to do?
My rule of thumb is to define the interface if I expect to have multiple implementations, either actual concrete application classes or a single application implementation and a fake implementation for unit testing. If I only expect a single implementation and the class doesn’t need faking (most don’t), then I’ll go the virtual method route and refactor to an interface as needed.