The Google testing blog has a nice post on how asserts inside the production code are not that good for testability. And the case they present is very true. Defensive programming is good when you don’t have tests.
If the code comes to a Debug.Assert(x != null) you’ll be presented with a nice message box. It puts real brakes on automation. But with Isolator, you don’t need to care about that.
You can use:
1 |
Isolate.Fake.StaticMethods<Debug>(); |
And that’s it. All the Debug.Assert calls are now ignored, and you can test the real production code.