I tried this (with one It.IsAny<IDataParameter>(). I know this
particular call uses 1 param parameter). I turned Strict on and MOQ
throws an exception "All invocations on the mock must have a
corresponding setup..".
Being new to Moq, take what I say with a grain of salt, but could you
not do something like:
mockContect.Expect(x => x.ExecuteBoolean(It.IsAny<string>(),
It.IsAny<TransactionManager>(), It.IsAny<IDataParameter[]>())
.Callback<string, TransactionManager,
IDataParameter[]>((s, t, p) => CheckParmsAndDoSomething()):
Note that I didn't test any of that, so YMMV.
That aside, what are you trying to do here? If you are trying to test
what the caller of ExecuteBoolean will do when it gets a
SystemExeception back, I don't think you need to go to such lengths.
Just do a ".Throws(...), without checking the parms. After all,
you're assuming that input is invalid and want to test the caller's
reaction to that.
If on the other hand, you are trying to check to make sure the caller
doesn't send null, just do the .Expect/.Setup, without a .Throws or
.Callback and Moq should take care of raising an exception if one of
the parms is null, since it won't meet the expectation.
/bs