At the moment RhinoMocks doesn't allow parallel execution of methods on a 
single proxy instance (RhinoInterceptor.cs - line 65). However, if you 
remove the synchronization I fear that it might cause hard to spot side 
effects on complex threaded tests; but no unit tests on RhinoMocks 
currently fails if you remove the synchronization block - but a more 
sophisticated solution might be desirable. So if you have a patch please 
post a pull-request on https://github.com/alaendle/rhino-mocks.

Am Dienstag, 7. Juli 2015 12:29:30 UTC+2 schrieb Ariel .b:
>
> i'm doing a mocked test that waits until something finishes. the problem 
> is ,that i can't run the 2nd method as it waits for the first one somehow.
>
> public interface ITest
>    {
>        void T1();
>        void T2();
>    } 
>
> the problem is in calling T2() - it waits for T1 to end. i don't 
> understand why
>
> [Test]
>   public void TestThread()
>   {
>      ITest t = MockRepository.GenerateMock<ITest>();
>      t.Stub(t1 => t1.T1()).WhenCalled((mi) =>
>         {
>            Thread.Sleep(10000);
>         });
>
>      t.Stub(t1 => t1.T2()).WhenCalled((mi) =>
>      {
>         // something
>      });
>
>
>      Task<string> task = Task.Factory.StartNew<string>(() =>
>      {
>         t.T1();
>         return "";
>      });
>
>      Thread.Sleep(1000);
>      t.T2(); // This hangs until T1 is finished!
>   }
>
> Anyone encountered this?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rhinomocks.
For more options, visit https://groups.google.com/d/optout.

Reply via email to