I'm looking at NMock2 as a framework to create mock objects during my unit
testing. One part that I'm trying to understand is that it will mock
interfaces, not concrete classes. I normally don't create interfaces for
every class. For example I normally don't have an interface for my business
object classes. A business object class is going to have too many unique
methods that I don't see the point of creating an interface that will only
ever have one class that implements it. That seems like overkill. However
if I want to mock the business object, it seems that with NMock2 I will need
to create an interface.
Am I understanding this correctly? Is my approach to interfaces wrong?
It looks like RhinoMock can mock interfaces or virtual methods of classes.
This raises a similar questions because I normally don't make everything
virtual. It seems like these frameworks would force me to change how I
design my classes to fit the frameworks. Is this right?
Any insights would be appreciated.
Thanks
Terry