In my MvcHandler, I'm now just overriding ProcessRequest in order to create the controller class by string name rather than by type. 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.
Only my laziness is stopping me. In order to do that for this little project I'd have to implement IHttpContext. Now, don't get me wrong, I
love the fact it's an interface. makes testing easier (possible), etc. But outside of testing, everyone will basically be wrapping a real HttpContext every time.
So the request: 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? 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!
PhilipRieck
Member
19 Points
12 Posts
Request for "HttpContextWrapper2"
Dec 13, 2007 02:34 PM|LINK
In my MvcHandler, I'm now just overriding ProcessRequest in order to create the controller class by string name rather than by type. 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.
Only my laziness is stopping me. In order to do that for this little project I'd have to implement IHttpContext. Now, don't get me wrong, I love the fact it's an interface. makes testing easier (possible), etc. But outside of testing, everyone will basically be wrapping a real HttpContext every time.
So the request: 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? 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!
Thanks!
Haacked
Contributor
6901 Points
412 Posts
Re: Request for "HttpContextWrapper2"
Dec 13, 2007 04:39 PM|LINK
For unit testing, try using this technique to create your IHttpContext concrete instance: http://haacked.com/archive/2007/11/05/rhino-mocks-extension-methods-mvc-crazy-delicious.aspx
As for making the html context wrapper public, we'll look into that. Thanks for the suggestion!
Senior Program Manager, Microsoft
What wouldn’t you do for a Klondike bar?