Stubbing ASP.NET Page.Form for unit tests

Fo unit testing ASP.NET controls I need a stubbed Page.

I can create an ASP.NET Page object in my unit tests by subclassing System.Web.UI.Page. However, I cannot find a way to set Page.Form. Adding a form with attribute (runat,server) does not work. Overloading the form in my Subclass does not give the required functionality.

Context: I try to unit test some homemade ASP.NET controls. These control require Page and Page.Form not to be null.

Any suggestions?

8
задан Hans 22 February 2011 в 14:13
поделиться