The previous post "Assert # of times a method was called" brings me to
the following scenario

==================================================
[Test]
public void Test()
{
    var foo = MockRepository.GenerateMock<IFoo>();
    foo.Expect(x => x.Bar()).Repeat.Times(5);

    Boo.Run(foo, 4);

    foo.VerifyAllExpectations();
}

public class Boo
{
    public static void Run(IFoo foo, int total)
    {
        for (int i = 0; i < total; i++) { foo.Bar(); }
    }
}

public interface IFoo
{
    void Bar();
}
==================================================

Obviously, it fails with "Expected #5, Actual #4."

However, if we change ".Repeat.Times(5);" to ".Repeat.Times(2);" it
passes!!? (I would expect a failure with "Expected #2, Actual #4.")


It looks like "as designed" behavior, since
UnorderedMethodRecorder.DoGetRecordedExpectationOrNull (https://rhino-
tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/rhino-mocks/
Rhino.Mocks/MethodRecorders/UnorderedMethodRecorder.cs) relies on
"triplet.Expectation.CanAcceptCalls" that is NOT updated for EVERY
call... But it's quite confusing.
--~--~---------~--~----~------------~-------~--~----~
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