nsubstitute/NSubstitute — Issue #64: Race condition between checking received calls 
Author: dtchepak
Created: 2011-12-06 08:47:44+00:00
State: open

@JakeGinnivan reported getting [the following exception](https://gist.github.com/1436620) when testing some multithreaded code:

````
NSubstitute.Exceptions.ReceivedCallsException: Expected to receive a call matching:
InvokeComplete()
Actually received 1 matching call:
InvokeComplete()
````

This [enqueued_action_is_not_executed_before_previous_action_finished](http://phoenixframework.codeplex.com/SourceControl/changeset/view/274263f762ad#src/Phoenix.WPF.Tests/Framework/ActionInvokerTests.cs) test failed intermittently (passed on its own, failed when run after other tests).

Problem looks like a race condition in [CheckReceivedCallsHandler](http://bit.ly/v37rde).