GenerateMock will return a dynamicMock, i.e. It will allow unspecified
calls to be made on it. So the behaviour you're seeing is correct

If you wanted the test to fail you could either explicitly create a
strict mock or use mockConsole.AssertWasNotCalled(x=>x.Print("b"));

2009/6/23 Kedar <[email protected]>:
>
>    public interface IConsole  {
>        void Print(string s);
>    }
>
>    [TestFixture]
>    public class SomeTestFixture
>    {
>        public void MethodToTest(IConsole console)
>        {
>            console.Print("a");
>            console.Print("b");
>        }
>
>        [Test]
>        public void Test()
>        {
>            var mockConsole = MockRepository.GenerateMock<IConsole>();
>            mockConsole.Expect(x => x.Print("a"));
>            MethodToTest(mockConsole);
>            mockConsole.VerifyAllExpectations();
>        }
>    }
>
> In this example, the only expectation I have is to call Print with
> argument "a". But the code under test calls it with "a" and then with
> "b". I thought that the VerifyAllExpectations assertion would fail.
> But it does not. Is this a problem or am I doing something wrong ?
>
> >
>

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