public void LimitedSizeQueueEnqueue(int enqueuesCount, int expectedQueueBlocksCount) { LimitedSizeBlocksQueue testQueue = new LimitedSizeBlocksQueue(3); for (int i = 0; i < enqueuesCount; i++) { testQueue.Enqueue(new Block(BitConverter.GetBytes(i), i)); } int actualQueueBlocksCount = testQueue.Count; Assert.AreEqual(expectedQueueBlocksCount, actualQueueBlocksCount); }
public void LimitedSizeQueueDequeue(int dequeuesCount, int expectedBlocksNumber) { LimitedSizeBlocksQueue testQueue = new LimitedSizeBlocksQueue(3); for (int i = 0; i < 3; i++) { testQueue.Enqueue(new Block(BitConverter.GetBytes(i), i)); } Block tempBlock = null; for (int i = 0; i < dequeuesCount; i++) { tempBlock = testQueue.Dequeue(); } int actualBlocksNumber = tempBlock.Number; Assert.AreEqual(expectedBlocksNumber, actualBlocksNumber); }