We are currently using Rhino Mocks to test our code in our C#, ASP.Net MVC projects, and some of the tests get really lengthy with mocking up all the repositories, services, and such.
Does anyone have any estimates, or know of where I might find estimates on how many lines of code can be saved, on average, by using Structuremap Automocker to create the mocks and stubs?
Asked
Active
Viewed 109 times
0

Russ Clark
- 13,260
- 16
- 56
- 81
-
1If you find yourself injecting a lot of mock objects for which you are not setting expectations, then the class containing the CUT isn't very cohesive. If you are setting expectations on most/all of them, then Structuremap won't change the LOC much. You still have to configure each one, or refactor into the setup code for the fixture - which you can do without Structuremap just as easily. – Keith Payne Aug 28 '13 at 19:44
-
I agree with @KeithPayne. If you have a hard time writing tests, you are most likely violating the [SOLID](http://en.wikipedia.org/wiki/SOLID) principles. I say: Back to the drawing board. – Steven Aug 30 '13 at 14:56