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.

You can write unit tests to verify ASP.NET MVC and Web API controller classes. When doing so, you need to ensure the unit test project references the core client objects required to easily communicate with ASP.NET MVC.

You can also create unit tests that run inside of 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, ...

Get Microsoft Visual Studio 2015 Unleashed, Third Edition 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.