private void PopTest(IStacks <int> stacks) { int[][] stackValues = GetStackValues(); for (int i = 0; i < stackValues.Length; i++) { for (int j = 0; j < stackValues[i].Length; j++) { int stackIndex = i; int value = stacks.Peek(stackIndex); int result = stacks.Pop(stackIndex); int newValue = (j < stackValues[i].Length - 1) ? stacks.Peek(stackIndex) : 0; Assert.AreEqual(value, result); Assert.AreEqual(false, (result == newValue)); } } }
private void PushTest(IStacks <int> stacks) { int[][] stackValues = GetStackValues(); for (int i = 0; i < stackValues.Length; i++) { for (int j = 0; j < stackValues[i].Length; j++) { int value = stackValues[i][j]; int stackIndex = i; stacks.Push(value, stackIndex); int result = stacks.Peek(stackIndex); Assert.AreEqual(value, result); } } }