private static void ValidateStack(Stack input, params object[] expectedContents)
{
Assert.Equal(expectedContents.Length, input.Count);
// Note: this reverts the stack
Stack currentStack = new Stack(input);
// The expected values are passed in in the order they are supposed to be in the original stack
// so we need to match them from the end of the array since the stack is also reversed
for (int i = expectedContents.Length - 1; i >= 0; i--)
{
Assert.Equal(expectedContents[i], currentStack.Pop());
}
}
}