Received is comparing arrays rather than array elements for equality with params arguments

232 views
Skip to first unread message

Colin Scott

unread,
Jul 31, 2010, 4:51:19 AM7/31/10
to NSubstitute
Hi Peoples,

I've been porting some tests to NSubstitute from Rhino Mocks and I've
run into an issue with arguments marked params. I have an instance Bus
which is an NServiceBus IBus instance. The Send method on this takes
an array of IMessage defined as params. I'd like to be able to
specify:

Bus.Received().Send(TestCommandMessage);

But this tells me that there are non-matching arguments. The test
passes if I change it to the less friendly:

Bus.Received().Send(Arg.Is<IMessage[]>(messages => messages[0] ==
TestCommandMessage));

Thanks
CDS

Anthony Egerton

unread,
Jul 31, 2010, 8:57:07 AM7/31/10
to nsubs...@googlegroups.com
Hi Colin,

Thanks for the bug report.
Will look into it and let you know when there is a fix.

Cheers,
Anthony Egerton

> --
> You received this message because you are subscribed to the Google Groups "NSubstitute" group.
> To post to this group, send email to nsubs...@googlegroups.com.
> To unsubscribe from this group, send email to nsubstitute...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nsubstitute?hl=en.
>

Anthony Egerton

unread,
Sep 3, 2010, 4:57:31 AM9/3/10
to nsubs...@googlegroups.com
There is a fix for this checked into the repository.
Would be great if you could confirm this solves your issue before we
do our next release.
Thanks.

Cheers,
Anthony

Colin Scott

unread,
Sep 3, 2010, 8:51:17 PM9/3/10
to NSubstitute
I've just tested this with the latest master and it now works after
failing with 0.1.3. Looks fixed to me. Thanks.

CDS
Reply all
Reply to author
Forward
0 new messages