O'Reilly logo

Professional Test-Driven Development with C#: Developing Real World Applications with TDD by Jeff McWherter, James Bender

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

ASP.NET WEB FORMS

In January 2002, ASP.NET was released with version 1.0 of the .NET Framework. This release marked a major milestone for web developers using Microsoft technologies, allowing them to produce powerful web applications using languages such as Visual Basic.NET and C#. ASP.NET includes tools you can use to develop web applications quickly by taking advantage of built-in controls that take care of the basic create, read, update, and delete (CRUD) operations for you. Components that shipped with the ASP.NET framework enabled you to drag and drop controls into your applications. This functionality allowed for a quick development process. But during that process the architecture and testability of many applications were never considered. Because these web applications stayed in the field as developers moved on to different companies or projects, patch after patch was applied to applications developed in this way, and the cost to maintain them increased.

Although these issues still exist to this day, you can use some techniques and patterns to unit-test ASP.NET Web Form applications.

Web Form Organization

A Web Form is made up of two parts. The ASPX file contains HTML, CSS, JavaScript, and ASP.NET markup. The second part is the code-behind file, either a CS or VB file that contains the executable code. Let's take a moment to discuss what should be contained in these files.

ASPX Files

ASPX files are the view of your web application pages that the user sees. As such, no business ...

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