Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rhino Mocks - Proper usage of Arg<T>.Ref

I'm having problems figuring out the proper arguments of the Arg option in RhinoMocks.

I am trying to mock the MSIRecordGetString method which has a ref Int32 parameter. Currently I have:

_Api.RecordGetString(Arg<IntPtr>.Is.Anything,
                     Arg<Int32>.Is.Anything, 
                     Arg<StringBuilder>.Is.Anything, 
                     ref Arg<Int32>.Ref( ???, 0).Dummy);

Can anyone let me know what ??? should/could be replaced with. I know it should be something of type AbstractConstraint but I'm not sure what is valid. Having difficulty finding any examples of proper usage.

Cheers.

like image 878
Ben Cawley Avatar asked Jul 12 '10 07:07

Ben Cawley


1 Answers

I'm actually used to Moq, but my understanding of that first argument is a constraint, but seeing as you don't particularly care for the value (I'm assuming), could you do the following:

ref Arg<Int32>(Is.Anything(), 0).Dummy

?

like image 90
Matthew Abbott Avatar answered Sep 22 '22 22:09

Matthew Abbott