public void Stack_Generic_Pop_AllElements(int count) { PooledStack <T> stack = GenericStackFactory(count); List <T> elements = stack.ToList(); foreach (T element in elements) { Assert.Equal(element, stack.Pop()); } }
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); } }