Wednesday, February 16, 2011

ASP.net WebForms MVP: Testable WebForms

Hello World,

I have been busy over the past month and a half trying to join the dots of relocating to my home town. Today, just out of interest I was searching for ways to make my ASP.net WebForms projects unit-testable. I had been able to figure out that I should encapsulate the data access, business logic et cetera to separate classes that could then be unit tested. The issue was how to automate testing of  caching, session and application based stuff as also code that depends on the ASP.net Page lifecycle (read the event chain).
           One idea I had was to write mock objects (something similar to what is echoed on StackOverflow). On some further digging, I found this: ASP.net MVP Framework and the associated Code from Codeplex.
Here are some more resources on this topic:
  1. WebForms MVP Contrib Framework 
  2. Getting Started with Inversion of Control and MVP
  3. MSDN Magazine on MVP design pattern
  4. StackOverflow discussion
The entire package is enticing enough to get my hands dirty. That obviously would follow once I settle down :)

Happy Coding,