Пример #1
0
        public void TestLeakyBucketEmpty()
        {
            QueueBuffer controller = new QueueBuffer();

            Assert.AreEqual(controller.Peek(), null);
            Assert.AreEqual(controller.Dequeue(), null);

            controller.Enqueue(NewPacket(10, 0));
            AssertPacket(controller.Peek(), 10, 0);
            AssertPacket(controller.Dequeue(), 10, 0);
            Assert.AreEqual(controller.Peek(), null);
            Assert.AreEqual(controller.Dequeue(), null);
        }
Пример #2
0
        public void TestLeakyBucketCapacity()
        {
            QueueBuffer controller = new QueueBuffer();
            int         capacity   = 200000;

            for (int i = 0; i < capacity; i++)
            {
                controller.Enqueue(NewPacket(10, 0));
            }
            controller.Peek();
            for (int i = 0; i < capacity; i++)
            {
                controller.Dequeue();
            }
        }