I have switch to latest build of the Rhino Mocks from the master to
use recursive mocks on an ASP.NET MVC project I'm working on.
I'm trying to set two expectations on HttpContext, like this:
controllerContext = MockRepository.GenerateMock<ControllerContext>();
controllerContext.Expect(x =>
x.HttpContext.Request.QueryString).Return(new NameValueCollection
{ { "Search", "Keyword" } });
controllerContext.Expect(x =>
x.HttpContext.User).Return(MockTestUser);
This is currently failing at runtime. Here's the stacktrace:
System.InvalidOperationException : Previous method
'ControllerContext.get_HttpContext();' requires a return value or an
exception to throw.
at Rhino.Mocks.Impl.RecordMockState.AssertPreviousMethodIsClose()
at Rhino.Mocks.Impl.RecordMockState.Replay()
at Rhino.Mocks.MockRepository.ReplayCore(Object obj, Boolean
checkInsideOrdering)
at Rhino.Mocks.RhinoMocksExtensions.Expect[T,R](T mock, Function`2
action)
If I have only of of the expectations above in place, no matter which
one, it works. Any ideas? I checked the tests projects to find out how
this can be achieved or if it is even supported, could not find out.
--
You received this message because you are subscribed to the Google Groups
"Rhino Tools Dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rhino-tools-dev?hl=en.