Summary

This chapter showed how you can use the unit test framework to define test projects and create test class files using the TestClass attribute. Each test method should include the TestMethod attribute. You can also data-bind unit tests using the DataSource attribute class.

Visual Studio allows you to generate unit tests from existing code. It also provides the Properties dialog box from Test View to help with generating your test attribute code.

You can write unit tests that are hosted by ASP.NET (either in IIS or the Visual Studio development server). An ASP.NET unit test uses the TestContext object to access information about the ASP.NET environment including the executing page, session, and server variables.

Writing unit tests can ...

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.