O'Reilly logo

Professional ASP.NET MVC 2 by Rob Conery, Scott Guthrie, Scott Hanselman, Phil Haack, Jon Galloway

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10. Test Driven Development with ASP.NET MVC

Before we start diving into Test Driven Development (commonly referred to by its acronym, TDD), we the authors need to make one thing clear: ASP.NET MVC is not solely for those who practice Test Driven Development. So if you don't practice TDD and planned to dismiss this chapter, please stick around for just one small moment. We're not going to try to convert you to TDD or be preachy about it (although Phil might if you happen to run into him on a street corner), but do give us a chance to explain why Microsoft's efforts to make this framework friendly to TDD fans benefits you, even if you're opposed to TDD.

So why is there all this focus on TDD when it comes to ASP.NET MVC? To understand the answer, it helps to have a bit of historical perspective. ASP.NET wasn't originally designed with TDD practitioners in mind. At the time, TDD was in its infancy and not as widely adopted as it is today. As a result, there are many areas of ASP.NET that provide challenges to those trying to write automated unit tests for developers making use of those areas, because they are tightly coupled with other subsystems.

A framework designed with testability in mind has more benefits than just being able to write unit tests. Such a framework is extremely extensible as a by-product of its being testable, since to write a proper unit test often requires isolating pieces of the framework and swapping out other dependencies that the framework uses with ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required