Many thanks for the insanely fast response - your solution works just
fine. I didn't realise that the first argument was captured even if I
specified its value explicitly (not to mention forgetting to cast the
last argument to object[]). Nice to see that It Just Works with params
as well.
Oh, thanks also to Richard Banks for his original blog posting that
compared NSubstitute to its peers; it would have passed under the
radar otherwise.
On Feb 11, 11:34 am, David Tchepak <
tche...@gmail.com> wrote:
> Hi David,
>
> You have an off-by-one error in referencing the Args. The following worked
> for me:
>
> Console.WriteLine(String.Format(CultureInfo.InvariantCulture,
> x.Args()[1].ToString(),
> (object[]) x.Args()[2]))
>
> You could also simplify the When..Do a little using WhenForAnyArgs (assuming
> you don't want to match the calls on the CultureInfo):
>
> .WhenForAnyArgs(x => x.DebugFormat(null, null))
>
> Hope this helps. :)
>
> Regards,
> Dave
>