Assigning out/ref parameters in Moq

Is it possible to assign an out/ref parameter using Moq (3.0+)?

I’ve looked at using Callback(), but Action<> does not support ref parameters because it’s based on generics. I’d also preferably like to put a constraint (It.Is) on the input of the ref parameter, though I can do that in the callback.

I know that Rhino Mocks supports this functionality, but the project I’m working on is already using Moq.

13 Answers
13

Leave a Comment