Sorry if that description isn’t clear…wasn’t sure how else to put it.
I have a custom membership registration form that I’ve created. It posts to a controller action in which I use model binding to populate a “User” object. The form has a “Password” field and a “ConfirmPassword” field. The Password field binds to the User object when binding occurs, but the ConfirmPassword doesn’t. So, in my controller action, when I validate that Password and ConfirmPasswords match, I check to ensure that user.Password and Request.Form[“ConfirmPassword”] are equal. Everything is working fine, until I get to the unit test.
I’m able to pass a User object into the controller action as a parameter for testing…but Request.Form[“ConfirmPassword”] doesn’t exist in the test context. How can I provide a Request.Form object to the test to use for testing purposes?
I did a quick search for the answer, and came up with this link – it purports to have solutions for both Moq and Rhino Mocks. They’re using ASP.NET MVC, so it may not be pertinent to your solution, but I’ll pass it on.
http://forums.asp.net/t/1309792.aspx