How are you achieving this: "wait for a bit (surely enough for the parallel threads to finish)" ?
Are you using .Join() (or a similar construct WAIT/SEMAFOR construct) to ensure all threads have actually completed before your subsequent call to .VerifyAll() or are you just doing a Thread.Sleep(n) call in your test method? Steve Bohlen [email protected] http://blog.unhandled-exceptions.com http://twitter.com/sbohlen On Fri, Jun 18, 2010 at 1:13 PM, Caio Kinzel Filho <[email protected]> wrote: > Hello guys, > > Do you know if MockRepository is thread-safe? > > I have some code here using an instance of MockRepository (new > MockRepository()) to set some Ordered and Unordered expectations. > The expectations are meant to be met by some code that will call the > mocks in parallel (using .NET 4 features). > My code and (especially) my tests work fine when I run them in a > single core environment (and test pass), but when I run them on a > multi-core machine, the expectations are not met (and test fail). Is > it supposed to work? Is it a known issue? Could I be doing something > wrong? > > My test flow is as follows: > > - create mockRepository and mocks > - set expectations (ordered and unordered) > - mockRepository.ReplayAll() > - call the expected methods on the mocks - in parallel (and here I'm > sure I am calling all the expected methods) > - wait for a bit (surely enough for the parallel threads to finish) > - mockRepository.VerifyAll() - expectations FAIL > > > Thanks, > Caio > > -- > 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]<rhinomocks%[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.
