4.4. Summary

So far, we have created some extension methods to simplify our testing and implemented a generic model binder that can be used by all our model objects to retrieve items from data. We have also cleaned up our tests and consolidated our mocks, which should dramatically increase our productivity when writing tests.

As much as I love writing code, I love refactoring it even more. That's when you go back to your code and try to find a better and more elegant solution. The power of TDD is in full display when you are refactoring your code. You have the comfort of knowing that there are tests to validate your changes, which is incredibly empowering. We have all been in situations in which we refactor a few lines of code and then something breaks a few days later; but with TDD, the odds of this happening are greatly diminished.

Get ASP.NET MVC 1.0 Test Driven Development: Problem - Design - Solution now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.