Mocking HttpContext: why would you do that?
By Jeroen on Sunday 18 January 2009, 10:55 - Permalink
You can just override the HttpContext.Current property with your own instance:
HttpContext.Current = new HttpContext( new HttpRequest(filename, url, querystring), new HttpResponse(new StringWriter()) );
This allows you to easily unit test code that depends on HttpContext.Current. I didn't realize this could be done until I read Ayende's post on the subject...