Hi, Tapio!
thanks for your solution. But it raises the following exception:
"System.InvalidOperationException : No expectations were setup to be
verified, ensure that the method call in the action is a virtual
(C#) / overridable (VB.Net) method call".
BTW how should I perform my task, if I do not want to make
Execute(Action tryExecuteAction) virtual?

Thanks in advance,
MuxMux.

On 20 дек, 20:24, Tapio Kulmala <[email protected]> wrote:
> Hi
>
> Assuming that your ExecuteWithAttempts is an extension method of
> System.Action and you really want to test that Execute method is called,
> you'll have to create a partialmock<Collector>
>
>         [SetUp]
>         private void SetupTests()
>         {
>             _mocks = new MockRepository();
>             _collector = _mocks.PartialMock<Collector>();
>         }
>
>         [TearDown]
>         private void TearDownTests()
>         {
>         }
>
>         [Test]
>         public void Start_ExecuteCalled()
>         {
>             Action action = _mocks.DynamicMock<Action>();
>             _mocks.ReplayAll();
>             _collector.Start();
>             _collector.AssertWasCalled<Collector>(x => x.Execute(action),
> options => options.IgnoreArguments());
>             _collector.VerifyAllExpectations();
>         }
>
> Tapio Kulmala
>
> "Those are my principles, and if you don't like them... well, I have
> others" - Groucho Marx
>
> http://twitter.com/tapiokulmalahttp://www.linkedin.com/in/tapiokulmalahttp://profiles.google.com/tapiokulmala
>
>
>
>
>
>
>
> On Tue, Dec 20, 2011 at 1:22 PM, MuxMux <[email protected]> wrote:
> > Hi!
> > So how the the test method should look like?
>
> > MuxMux.
>
> > On 18 дек, 18:38, Tapio Kulmala <[email protected]> wrote:
> > > Hi!
>
> > > You are not testing your Collector at all, Create a real collector
> > instead
> > > of a mock.
>
> > > _collector = new Collector();
>
> > > Tapio Kulmala
>
> > > "Those are my principles, and if you don't like them... well, I have
> > > others" - Groucho Marx
>
> >http://twitter.com/tapiokulmalahttp://www.linkedin.com/in/tapiokulmal...
>
> > > On Sat, Dec 17, 2011 at 8:20 AM, MuxMux <[email protected]> wrote:
> > > > Hi Andreas,
>
> > > > thanks for your reply, but your suggestion did not help. I got
> > > > the same exception as before:
> > > > Rhino.Mocks.Exceptions.ExpectationViolationException :
> > > > Module.Execute(any); Expected #1, Actual #0.
>
> > > > MuxMux.
>
> > > > On 16 дек, 14:07, haifisch <[email protected]> wrote:
> > > > > Just make Execute virtual ;-)
>
> > > > > Br,
>
> > > > > Andreas
>
> > > > --
> > > > 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.
>
> > --
> > 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.

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