示例#1
0
        void TestBoundedBlockingQueueAddRemove()
        {
            BoundedBlockingQueue <TestQueueItem> bbq = new BoundedBlockingQueue <TestQueueItem>(1);

            Assert.Equal(0, bbq.Count);

            Assert.Throws <InvalidOperationException>(() => bbq.Add(new TestQueueItem {
                Value = 100
            }));

            Assert.Equal(0, bbq.Count);

            Assert.Throws <InvalidOperationException>(() => bbq.Remove(new TestQueueItem {
                Value = 100
            }));

            Assert.Equal(0, bbq.Count);
        }