I should clarify, I had to do Expect.Call().Repeat.Any.Do() in order
to get it to call my delegate everytime the Send() method was called.

On Aug 11, 2:48 pm, Ben M <[email protected]> wrote:
> I have a partial mock on a class I'll call 'Publisher'
>
> the publisher has a method called 'Publish' that in turn calls a
> virtual method called Send as follows:
>
> public class Publisher
> {
>      public bool Publish(MyList list)
>      {
>           string msg = _msgBuilder.BuildFrom(list);
>           bool success = Send(msg);
>
>           return success;
>     }
>
>      public virtual bool Send(string msg)
>      {
>             /// snip
>            return true;
>       }
>
> }
>
> my unit test then does the following:
>         [SetUp]
>         public void Setup()
>         {
>
>             _mocks = new MockRepository();
>
>             _publisher = _mocks.PartialMock<Publisher>();
>
>         }
>
> [Test]
> public void OnlyCallSendOnceForEmptyLists()
> {
>                 Expect.Call(_publisher.Send(null))
>                     .IgnoreArguments()
>                     .Return(true)
>                     .Repeat.Once;
>
>             _mocks.ReplayAll();
>
>             _publisher.Publish(new MyList());
>             _publisher.Publish(new MyList());
>
>             _mocks.VerifyAll();
>
> }
>
> I would expect this test to fail as it should be expecting no more
> than 1 call, but the test is passing, and stepping thru the debugger I
> can see it IS in fact making 2 calls, yet the test still passes.  What
> am I doing wrong that causes this test to give me a false positive?
>
> thanks in advance
> Ben
--~--~---------~--~----~------------~-------~--~----~
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