Just make Execute virtual ;-)

Br,

Andreas

On 16 Dez., 09:03, MuxMux <[email protected]> wrote:
> Hello!
> Could you, please, tell me how can I test the following class:
>
> public class Collector
> {
>         public void Start()
>         {
>             Execute(TryCollect);
>         }
>
>         public void Execute(Action tryExecuteAction)
>         {
>                 Action action = tryExecuteAction;
>                 action.ExecuteWithAttempts(MaximumAttempts,
> PauseAfterFailedAttempt);
>         }
>
>         protected virtual void TryCollect() { }
>
> }
>
> Namely, I would like to test if the Execute(TryCollect) method is
> called within the Start() method.
> I am trying to do it as follows:
> public class CollectorTests
> {
>         private MockRepository _mocks;
>         private Collector _collector;
>
>         [SetUp]
>         private void SetupTests()
>         {
>             _mocks = new MockRepository();
>             _collector = _mocks.DynamicMock<Collector>();
>         }
>
>         [TearDown]
>         private void TearDownTests()
>         {
>             _mocks.VerifyAll();
>         }
>
>         [Test]
>         public void Start_ExecuteCalled()
>         {
>             Action tryCollect = _mocks.DynamicMock<Action>();
>             Expect.Call(() =>
> _collector.Execute(tryCollect)).IgnoreArguments();
>
>             _mocks.ReplayAll();
>             _collector.Start();
>         }
>
> }
>
> but with no luck. What I am doing wrong?
> Thanks in advance,
> MuxMux.

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