Is it possible to use AssertWasCalled with a custom IEqualityComparer implementation?

33 views
Skip to first unread message

mark Kharitonov

unread,
Oct 23, 2011, 5:21:17 AM10/23/11
to rhino...@googlegroups.com
I have the following code snippet:

    Action<IProbingErrorHandler> handlerAction = x => x.Post(sourceContext, channelId, probingError);
    var handler = MockRepository.GenerateStub<IProbingErrorHandler>();
    handler.Stub(handlerAction);
    ...
    handler.AssertWasCalled(handlerAction);

Unfortunately, I had to implement the Equals method in the argument types in order for the last assertion to work. Is there a way to use a custom IEqualityComparer implementation instead?

Thanks.

P.S.
I have posted the same question on SO - http://stackoverflow.com/questions/7861996/rhino-mocks-can-assertwascalled-use-a-custom-iequalitycomparer-when-comparing-t

David Tchepak

unread,
Oct 23, 2011, 7:40:36 AM10/23/11
to rhino...@googlegroups.com
Answered on SO, but to summarise, I think you need to use custom argument constraints:

Hope this helps,
David

--
You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rhinomocks/-/vAHF8ObHNJkJ.
To post to this group, send email to rhino...@googlegroups.com.
To unsubscribe from this group, send email to rhinomocks+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rhinomocks?hl=en.

Reply all
Reply to author
Forward
0 new messages