一直在玩AutoMocking。
使用moq.contrib.indy时调用控制器时出现以下错误
{“值不能为空。\ r \ nParameter name:controllerContext”}
var mocks = new AutoMockContainer(new MockRepository(MockBehavior.Loose));
mocks.GetMock<IAccountService>().Setup(x => x.AddSweepstake(new AddSweepstakeViewModel()));
mocks.GetMock<IRepository<Account>>().Setup(x => x.SaveOrUpdate(new Account())).Returns(new Account()).Verifiable();
mocks.Create<AccountController>().AddSweepstake(new AddSweepstakeViewModel()); //fails on this line
通常会这样做
var context = new Mock<HttpContextBase>();
如何使用AutoMocking模拟控制器上下文?