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 ...

Get Professional Test-Driven Development with C#: Developing Real World Applications with TDD 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.