what you want is to use a strict mock and have only single method
expectation.  In your act section, you can call the method twice as
usual.  I dont think you need to reset mock history.

On Apr 2, 2:59 pm, Karl <[email protected]> wrote:
> Hi all,
>
> I want to test the following behaviour.
>
> When the method ChangeRole() of my object under test (variable name
> "_logic") is called and the same request is already pending the object
> under test should not send a second request to the server.
> The server is represented by the mock object "DispServerConnection".
>
> The precondition for my test would be to call the method ChangeRole.
> (Arrange)
> Then I call the method a second time (Act)
> And afterwards I assert that the SendDeselectRoleCadRequest method was
> not called on the DispServerConnection mock when the ChangeRole method
> was called a second time.
>
> The problem however is, that the test always fails because the method
> was actually called during the Arrange phase. So I'm wondering how I
> can tell my mock to "forget" everything it has recorded until now and
> start from scratch. Is this even possible without creating a fresh
> mock instance?
> In the Record/Replay model all recordings on a mock were cleared after
> calling Verify but I'm not sure how this is supposed to work in the
> AAA model.
>
>       public void
> ShouldNotSendDeselectRoleCadRequest_IfDeselectRoleRequestPending()
>       {
>          // Arrange
>          InitializeObjectUnderTest();
>          _logic.ChangeRole();
>          // How can I clear the recorded method calls on my mock
> here???
>
>          // Act
>          _logic.ChangeRole();
>
>          // Assert
>          DispServerConnection.AssertWasNotCalled(x =>
> x.SendDeselectRoleCadRequest());
>       }
>
> Thx for your help!

-- 
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