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.

On Jun 22, 2009 10:23 AM, "ben.biddington" <[email protected]> wrote:


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;

               // BJB, 2009-06-22
               return true;
               // return expected.Max == null || actualCallsCount <
expected.Max.Value;
           }
       }

Any tips?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/RhinoMocks?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to