I\'m tring to use a lambda with a multiple-params function but Moq throws this exception at runtime when I attempt to call the mock.Object.Convert(value, null, null, n
Perhaps it's because you are passing null
but It.IsAny
is expecting any object
except null
? What happens if you do the following?:
var actual = mock.Object.Convert(value, new object(), typeof(object), CultureInfo.CurrentCulture);
This is just a stab in the dark from me, I'm more familiar with Rhino.Mocks.
My 2nd guess:
Having looked at the Moq.chm that comes with the download,
You are using the Setup(Expression
method which "Specifies a setup on the mocked type for a call to a void
method."
You want te Setup
method that "Specifies a setup on the mocked type for a call to a value returning method".
So you could try:
mock.Setup(
conv => {
conv.Convert(
It.IsAny