So: I’d like to count method calls in Rhino Mocks with something more specific than Any(), Once() or AtLeastOnce(). Is there any mechanism for doing this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The trick is to use Repeat.Times(n), where n is the number of times.
Suprisingly the below test will pass, even if the method is called more often than expected:
To work around this use the below method:
Source: http://benbiddington.wordpress.com/2009/06/23/rhinomocks-repeat-times/
(look there for an explanation)
EDIT: only edited to summarise at the start, thanks for the useful reply.