public static void TrimToSize(int count)
{
Queue queue1 = Helpers.CreateIntQueue(count);
Helpers.PerformActionOnAllQueueWrappers(queue1, queue2 =>
{
queue2.TrimToSize();
Assert.Equal(count, queue2.Count);
// Can change the queue after trimming
queue2.Enqueue(100);
Assert.Equal(count + 1, queue2.Count);
if (count == 0)
{
Assert.Equal(100, queue2.Dequeue());
}
else
{
Assert.Equal(0, queue2.Dequeue());
}
});
}