As an excercise I want to implement a solution to the producer-consumer problem. Let's say I'll have an array int[] buffer and two methods Produce() and Consume() that will simulate the producer and customer, respectively, and one "Execute" method to call both method asynchronously.
It's probably to test whether the implementation will not result in a deadlock, just make Produce and Consume repeat for a large number of time (like 1 million), make Execute wait for these two methods to finish, and then (in my unit test) just make sure the call returns after certain time (maybe 1 minute). But how to test whether there is no race condition or data corruption in the implementation?