Paste this code in and give it a whirl, it demonstrates what you're after.

[Test]
public void TestDelay()
{
    var stub = MockRepository.GenerateStub<IFoo>();

    // Step 1 run with the line below
    stub.Stub(x => x.Bar).Return(5);

    // Step 2 run with this line (comment out the above line)
    // stub.Stub(x => x.Bar).WhenCalled(invocation =>
Thread.Sleep(1000)).Return(5);


    Console.WriteLine(DateTime.Now);

    Console.WriteLine(stub.Bar);

    Console.WriteLine(DateTime.Now);
}

public interface IFoo
{
    int Bar { get; }
}

On Thu, Oct 1, 2009 at 7:35 AM, Shrihari Devji <[email protected]>wrote:

>
> HI Rahien,
>
>  Please let me know if my understanding is correct.
>  MockRepository mockRepo = new MockRepository();
>  decServiceMock = mockRepo.StrictMock<MockClass>();
>  Expect.Call(invocation => Thread.Sleep(100)).IgnoreArguments();
>
>  Will it add a delay in response of expect call method?
>
> Regards
> Shrihari Devji
>
> On Oct 1, 3:38 pm, Ayende Rahien <[email protected]> wrote:
> > WhenCalled( invocation => Thread.Sleep(100));
> >
> > On Thu, Oct 1, 2009 at 12:28 PM, Shrihari Devji <[email protected]
> >wrote:
> >
> >
> >
> >
> >
> > > Hi
> > >   I am using a Rhino mock to mock a WCF service. I want to test my
> > > client code when there is a more than expected delay from the server.
> > > Is there a way using which I can introduce a delay using rhino mock to
> > > simulate the scenario?
> > >     It will help me to test my code.
> >
> > > Thanks in Advance- Hide quoted text -
> >
> > - Show quoted text -
> >
>


-- 
Tim Barcz
Microsoft ASPInsider
http://timbarcz.devlicio.us
http://www.twitter.com/timbarcz

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