public void ClosedQueueWithBlockedReader()
{
bool test = false;
BoundedBlockingQueue<int> q = new BoundedBlockingQueue<int>(10);
Thread t = new Thread(new ParameterizedThreadStart( (object o) =>
{
try
{
((BoundedBlockingQueue)o).ReceiveInner();
test = false;
}
catch (BoundedBlockingQueue.ClosedQueueException)
{
test = true;
}
}
));
t.Start(q);
Thread.Sleep(100);
q.CloseEntrance();
t.Join();
Assert.IsTrue(test);
}