Request for "HttpContextWrapper2"http://forums.asp.net/t/1193956.aspx/1?Request+for+HttpContextWrapper2+Thu, 13 Dec 2007 16:39:55 -050011939562058064http://forums.asp.net/p/1193956/2058064.aspx/1?Request+for+HttpContextWrapper2+Request for "HttpContextWrapper2" <p>In my MvcHandler, I'm now just overriding ProcessRequest in order to create the controller class by string name rather than by type.&nbsp; Since MvcHandler doesn't do much more than determine a controller type, instantiate it, and call it's execute method, I'd actually like to forgo subclassing it completely.&nbsp;&nbsp; </p> <p>&nbsp;Only my laziness is stopping me.&nbsp;&nbsp; In order to do that for this little project I'd have to implement IHttpContext.&nbsp;&nbsp;&nbsp; Now, don't get me wrong, I <b>love</b> the fact it's an interface.&nbsp; makes testing easier (possible), etc.&nbsp; But outside of testing, everyone will basically be wrapping a real HttpContext every time.<br> &nbsp;</p> <p><b>So the request</b>: since you've already written a HttpContext wrapper, perhaps you could expose it in the shipping bits, and allow us to create one given a HttpContext?&nbsp; The interface is a big one, and having everyone create their own - well, think of all the collective keystrokes and testing time you'd be saving!&nbsp; </p> <p>Thanks!<br> &nbsp;</p> 2007-12-13T14:34:58-05:002058336http://forums.asp.net/p/1193956/2058336.aspx/1?Re+Request+for+HttpContextWrapper2+Re: Request for "HttpContextWrapper2" <p>For unit testing, try using this technique to create your IHttpContext concrete instance: <a href="http://haacked.com/archive/2007/11/05/rhino-mocks-extension-methods-mvc-crazy-delicious.aspx"> http://haacked.com/archive/2007/11/05/rhino-mocks-extension-methods-mvc-crazy-delicious.aspx</a></p> <p>As for making the html context wrapper public, we'll look into that. Thanks for the suggestion!</p> 2007-12-13T16:39:55-05:00