CHAPTER 1
The purpose of this book is not to evangelize that unit testing will save you time and money in your development process and that it will improve the quality of your product, but rather to:
All code examples have been tested in both Visual Studio 2008 Pro with .NET 3.5 and Visual Studio 2012 Pro with .NET 4.5.
Due to changes in the Test Explorer window of Visual Studio 2012, the test result screenshots are from Visual Studio 2008, which has a layout more suitable for conveying both the test result and the test result message. The exceptions to this are screenshots from other unit test applications, such as NUnit.
The reader is expected to have knowledge of C# and the .NET Framework. Some of the examples require knowledge of lambda expressions and LINQ.
The first part of this book discusses the purpose, philosophy, and practice of unit testing:
“How Does Unit Testing Work?" describes how a unit test engine works by creating a simple console-based unit test engine.
“Common Unit Test Tools” is a brief overview of unit testing engines.
Writing unit tests with Visual Studio’s unit test engine and NUnit are then covered in detail in the following chapters:
The book concludes with a discussion of advanced unit testing, dealing with code coverage and techniques for accessing internal fields and methods, followed by a chapter on other uses for unit testing.