Mocking method call with out param and no return value in Rhino Mocks
So I've got this method called LoginUser:
public void LoginUser(out SystemUse开发者_JAVA百科r 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?
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.
精彩评论