views:

47

answers:

0

Hello,

I'm having a strange error trying to create a unit test. I'm trying to mock IPresenterFactory of the WebFormsMvp framework to force the return of a presenter. So I'm mocking it as:

var view = ..;
var presenter = new TestPresenter(view);
var factory = mock.Stub<IPresenterFactory>();
factory.Expect(i => i.Create(null, null, null)).IgnoreArguments().Return(presenter);
//OR: Expect.Call(factory.Create(null, null, null)).IgnoreArguments().Return(presenter);

Where presenter is a valid presenter (a test presenter class that's public within the test class). I also tried changing Expect with Stub and same issue: the presenter returned is actually null, not my test presenter.

What am I doing wrong; why won't the factory return the presenter? Just getting started with RhinoMocks...

Thanks.