Used the create unit tests tool in Visual Studio and obviously it tries to instantiate my abstract classes.
My question is: Should I try to unit test the way Visual Studio is trying to get me to do it, or should I create a mock class to be instantiated, or should I only test the methods that use this abstract class?
Thanks.
There are two opposite points of view:
I prefer second option (currently) and testing abstract classes using RhinoMocks PartialMock feature which allows me to create a mock of an abstract class.
use from mockrepository :
Just test the implementing classes.
You could always create a specific implementation for testing that adds no extra functionality.
Listen to the tests. Using mocking tools that do magic to allow testing abstract classes and private methods etc. are a test code smell
If there are methods on this abstract class that are worth testing, then you should test them. You could always subclass the abstract class for the test (and name it like MyAbstractClassTesting) and test this new concrete class.