public void Stack_Generic_TrimExcess_AfterRemovingOneElement(int count) { if (count > 0) { PooledStack <T> stack = GenericStackFactory(count); List <T> expected = stack.ToList(); T elementToRemove = stack.ElementAt(0); stack.TrimExcess(); stack.Pop(); expected.RemoveAt(0); stack.TrimExcess(); Assert.Equal(expected, stack); } }