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 ...
Get Microsoft® Visual Studio® 2010 Unleashed 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.