Repeat times passes when actual invocation count > max
27 views
Skip to first unread message
ben.biddington
unread,
Jun 22, 2009, 12:15:40 PM6/22/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Rhino.Mocks
When I use something like:
mock.Expect(x => x.Xxx()).Repeat.Times(4);
I am expecting x.Xxx() to be invoked exactly 4 times. I find my test
fails (as expected) provided the actual number of times it's invoked
<= 4.
My test passes (not expected) when actual number of times > 4.
This seems to be due to AbstractExpectation not accepting call once
the maximum has been reached (4 in this case).
If I modify the following property as follows, I get the expected
behaviour:
// AbstractExpectation
public bool CanAcceptCalls
{
get
{
//I don't bother to check for RepeatableOption.Never
because
//this is handled the method recorder
if (repeatableOption == RepeatableOption.Any)
return true;
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Rhino...@googlegroups.com
We had an earlier discussion about this and it was decided it was as designed. I think if you use the AAA syntax and do a post assert the repeat times works as you would expect.