When I migrated sample SportsStore app from Steve Sanderson's Pro ASP.NET MVC Framework (from asp.net 1.0 to mvc 2 beta) using this app provided by eric lipton, everything work just fine - except 2 unit tests.
The error message on both is:
Tests.CartControllerTests.VeryLongTestMethodName:
System.ArgumentNullException: value can't be undefined.
Parameter name: context
I suspect this is because default model binder in version 2 supports DataAnnotations, because stack call trace from NUnit told me about some problems in DefaultModelBinder. Any ideas how can I fix it?
EDIT
Tried to use Moq to solve the problem, but it didn't work.
Here's the code:
var request = new Moq.Mock<HttpRequestBase>();
request.Setup(r => r.HttpMethod).Returns("POST");
var mockHttpContext = new Moq.Mock<HttpContextBase>();
mockHttpContext.Setup(c => c.Request).Returns(request.Object);
controllerContext = new ControllerContext(mockHttpContext.Object, new RouteData(),
new Moq.Mock<ControllerBase>().Object);
Method I'm testing submits only POST. Is it ok to put "POST" to my tests?