Are there any circumstances where it is favourable to manually create a stub type, as opposed to using a mocking framework (such as Rhino Mocks) at the point of test.
We take both these approaches in our projects. My gut feel when I look at the long list of stub versions of objects is that it will add maintenance overhea开发者_运维知识库d, and moves the implementation of the stub away from the point of test.
When you reach the point where stubs take up too much maintenance time, it's time to move on to a stub/mock framework. So I think you have given the answer already yourself.
Currently I'm still using stubs with my current project, for the sake of simplicity. There are only a few types for which I use a stub, and usually there's only one stub, sometimes two to recreate errors, but no more.
For the purposes of automated unit tests, mocks are almost always the better option. Because they use reflection to mock an object, they will stay up-to-date when you make changes.
The only time I create a stub is for integration testing - for example, you might stub an SMS Sending Service so you can run a period of integration / user testing without being charged for sending out SMS Messages (instead, the messages are stored so they can be checked).
精彩评论