Creating an interface in your code to abstract away the calls to Session and HttpContext is definitely the way to go. Do that and Rhino Mocks can solve your issues.
My problem is that I'm testing code that makes calls to Microsoft.ApplicationBlocks.UIProcess (UIP). It's all the UIP code that's giving me the problem, and I'm extremely reluctant to rewrite the code in the App Block. I can't see a way to use Rhino Mocks to solve this at all. I found a piece of code called HttpSimulator which is up on Phil Haack's blog. http://haacked.com/archive/2007/06/19/unit-tests-web-code-without-a-web-server-using-httpsimulator.aspx. It's great! As far as I've seen so far, you wrap your test code in a call to the HttpSimulator and it will set up all the HttpContext and Session fields that would otherwise be missing. It has one problem, though: HttpContext.Current.Handler still evaluates as null and is making my tests fail. I have been banging my head against the wall all day trying to find a workaround for this. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rhinomocks?hl=en -~----------~----~----~----~------~----~------~--~---
