Is it possible to Serialize or Create a System.Web.UI.Page item?

I have a method that takes a System.Web.UI.Page as an input and returns some application specific details (what "type" of page it is, if certain items are in the query string, etc...). To run a unit test on this I was trying to create a System.Web.UI.Page item (in the code I am able to just send this.Page).

First Attempt: Serialization - I tried to serialize the page to a file and then deserialize to create the standard test page. Received many errors about not being able to serialize a Page. Is there anyway to write that object to a file?

Second Attempt: new Page() - I tried to just create the page and set the items I was interested in, but all the items I'm interested in appear to be read-only (no setter). Is there some way to create a System.Web.UI.Page programatically?


Why not mock out the Page class using a mocking framework? This is exactly the kind of scenario mocking is used for. I personally like Moq.

Need Your Help

converting PWSTR variable to upper case in vc++

visual-studio-2010 visual-c++

how i can convert PWSTR variable to uppercase in vc++. I googled but didn't get the code sample.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.