Unit Testable HttpModule and HttpHandler - Kazi Manzur Rashid's Blog(weblogs.asp.net)

submitted by iftekharahmedamitiftekharahmedamit(530) 3 years, 2 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.

add a comment |category: |Views: 274

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

No comments so far

information Login or create an account to comment on this story