O'Reilly logo

Microsoft Visual Studio 2015 Unleashed, Third Edition by Mike Snell, Lars Powers

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

Unit Testing ASP.NET Pages

You may need to create a unit test that calls older web code (code that is not segmented like MVC or Web API). You might also just want to create tests that call specific web pages and validate the results. Sometimes you need access to Page and Session objects in your tests, for example. In this case, you can create an ASP.NET unit test. These tests are configured to be hosted by a web server (local or IIS) and can call directly into your pages and ASP.NET environment.

To get started, add a new test project to your web solution (or create a new solution and project designed to test your website). You will also need the attribute classes found in the Microsoft.VisualStudio.TestTools.UnitTesting.Web namespace. No need ...

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