O'Reilly logo

Microsoft® Visual Studio® 2010 Unleashed by Lars Powers, Mike Snell

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

Generating Tests from Existing Code

Visual Studio also provides a means of automating the creation of unit tests. You can right-click an existing class and choose Create Unit Tests from the context menu. Alternatively, you can select the Unit Test Wizard item template to do the same. In either case, Visual Studio actually generates a set of unit tests based on the code in your class.

What is generated is a good start toward building your unit tests. Visual Studio actually examines the methods and properties in the class from which you want to generate tests and writes out real, possible tests. Of course, you have to finish each test by adding the appropriate variable values and the right assertions, but what is generated by the tools makes for ...

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