In fact I have something like

using Ordered()
{
    using Unordered(){}
    ...
    using Unordered() {}
}

where the parallel code is in an Unordered block.
The ordered call is to make sure (test) a barrier-like functionallity


On Mon, Jun 21, 2010 at 14:06, Tim Barcz <[email protected]> wrote:
> Seems odd to have defined ordered tests and then parallelize them (where
> presumably order doesn't matter)
>
> On Mon, Jun 21, 2010 at 12:03 PM, Caio Kinzel Filho <[email protected]>
> wrote:
>>
>> @Tim
>>
>> Yes, the code under test is parallelized (some Parallel.ForEach)
>>
>>
>> @Steve
>>
>> As I do not expose any internal implementation of how the
>> parallelization works (i.e. exposing the started Tasks), I do not know
>> how could I Join the threads.
>> I'm just Thread.Sleeping for a while, enough for the threads to
>> complete (I could see that console.writing on the end of the methods)
>>
>>
>> On Mon, Jun 21, 2010 at 11:37, Stephen Bohlen <[email protected]> wrote:
>> > 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].
>> >> 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.
>>
>
>
>
> --
> Tim Barcz
> Microsoft C# MVP
> 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.
>

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