One big bummer of unit-testing (especially with nunit) is, that you cannot test web-based code.
OK, so I kinda gave up on that one. But I recently developed quite some code, targeted to ease development of web-based apps. So this code is making use of the HttpContext in order to get to know something about who’s actually make the request etc.
So with regards to Phil Haacked I wrote a little method to inject a fake HttpContext and thus could at least write some unittest for my project.
HttpContext.Current.User is returning
null – so I might have to look a little bit around. I already figured, that Phil did an update on his original post – I’ll check that out!