Unit Testable HttpModule and HttpHandler - Kazi Manzur Rashid's Blog(weblogs.asp.net)
submitted by
iftekharahmedamit(530) 2 years, 11 months ago
With the new System.Web.Abstraction namespace we can now easily write unit testable HttpModule and HttpHandler. In this post, I will show you how to write unit testable HttpModule and HttpHandler.
Prior the release of System.Web.Abstraction the problem with unit testing of these web infrastructural items is HttpContext, it is sealed, no way to mock it with Rhino or Moq. The only option is to create the wrapper objects of these non-mockable objects but it has a very long tail like HttpRequest, HttpResponse, HttpSessionState, HttpServerUtility etc etc. And this is the exact thing that the System.Web.Abstraction provides, all wrappers around the non-mockable objects of HttpContext. But still, both the HttpModule and HttpHandler depends upon the original HttpContext which I hope will change in ASP.NET 4.0. till then we need to create a super layer for making it Unit Testable.
read more...
|category: ASP.NET
|Views: 264
tags:
ASP.NET another
Everyones tags:
Your Tags: