views:

157

answers:

1

So I've got this method called LoginUser:

public void LoginUser(out SystemUser userToLogin, string username)

Having just started with Rhino Mocks, I'm having a little trouble mocking a call and return value from this method while testing my Presenter code. What's the correct syntax in this instance?

+2  A: 

Does this blog post help? Code sample:

IList<RecordModel> ReadPaged(int pageNumber, int pageSize, out int recordCount);
...
recordRepositoryStub
 .Stub(m => m.ReadPaged(pageNumber, pageSize, out recordCount))
 .OutRef(250)
 .Return(records);

Basically, look for the OutRef method and use that to return the right result :)

As an aside, does your method have to be in that form? Using an out parameter in a void method is usually a bit of a design smell.

Jon Skeet
Thanks! I didn't write said code, but yes I was thinking I might petition to have it changed...
Paul