I wrote in a past article
about unit testing ASP.NET pages. It is also possible to work with user
controls, with some additional considerations. User controls inherit from
System.Web.UI.UserControl class; however, it is possible to create an
intermediate class, between the UserControl class and the ASP.NET user control
(.ascx). This can perform more advanced capabilities and allow the user control
to be unit tested, at least partially.
In addition, by crafting an application in a certain way, it
can be possible to perform more advanced testing, such as the testing of
dynamic table generation within the user control, of data binding to a data-bound
control, or other features.