One of the main differences between the ASP.NET MVC framework and the classic WebForm paradigm is that the first has been designed and implemented with testability in mind. Adopting the MVC pattern is a big step toward testability, but it's not enough; the MVC framework includes a lot of other features and requires API design decisions to make sure that it will support any kind of unit testing.
In Chapter 9 you learn how to test a Web application developed with the ASP.NET MVC framework and what all these test-facilitating features are. To help you fully understand them, this chapter covers the basic concepts of unit testing.
In this chapter you learn:
What unit testing is and why it is important
How to write tests
What patterns enable unit testing in complex applications
Unit testing is a vast topic and probably even a whole book would not be enough to cover all the aspects of this important practice. In this section, you learn the basic concepts and why you should start testing your applications right now.
Unit testing is a practice used in software development to verify that individual units of code are working the way they were originally supposed to. What a unit is depends on the kind of programming language you are using, but in object-oriented programming, the smallest testable unit is a method.
The main reason why you might want to use a unit test to validate that a single piece of your source code is working properly is that ...