Help testing mvc3 controller that accesses querystring
Just started learning mvc3. I've built a fairly basic w开发者_JAVA技巧ebsite (also using EF-Code-First if that makes a difference), now I'm trying to progress to building tests for it
My controller gets querystring data by going Request["whatever"]
, and when I run the test it says request is null
All the tutorials I've looked at so far have kinda lost me. Going into mocks and such, which they seem to assume prior knowledge of (never used mocks, so don't understand them yet)
Does anyone have a nice and basic tutorial to get me into unit testing? Or perhaps could give me an example
It is against MVC's design pattern to use HttpRequest directly. You can access the query string variables on your action as parameters.
精彩评论