I would like to do something like :
ObjectRecorder.Start();
//Do stuff here ...
ObjectRecorder.Stop();
//And get the result
List<Object> result = ObjectRecorder.GetAll();
//or even
ObjectRecorder.GetNumberInstanceCreated();
What I am trying to achieve
I am using a BlockingCollection and profiling my application I saw that the TryTake is creating object internaly. As I am calling this method really often, I would like to expose the bug with a unit test and then implementing a new ImprovedBlockingQueue and seeing that the problem is solved.
Any ideas?