public void _3_1_ThreeStack_WithTooManyPushesTestCases_ShouldThrowException(int eachStackSize, int stackNumber) { ThreeStackFixedSize threeStack = new ThreeStackFixedSize(eachStackSize); for (int i = 0; i < eachStackSize; i++) { threeStack.Push(stackNumber, i); } Assert.Throws <Exception>(() => threeStack.Push(stackNumber, 100)); }
public void _3_1_ThreeStack_withValidPeeks_ShouldReturnTopValues() { ThreeStackFixedSize threeStack = new ThreeStackFixedSize(2); threeStack.Push(1, 10); threeStack.Push(1, 20); threeStack.Push(2, 30); threeStack.Push(2, 40); threeStack.Push(3, 50); threeStack.Push(3, 60); Assert.AreEqual(20, threeStack.Peek(1)); Assert.AreEqual(40, threeStack.Peek(2)); Assert.AreEqual(60, threeStack.Peek(3)); }
public void _3_1_ThreeStack_withManyValidPeeks_ShouldReturnTopValueEveryTime() { ThreeStackFixedSize threeStack = new ThreeStackFixedSize(2); threeStack.Push(1, 10); threeStack.Push(1, 20); threeStack.Push(2, 30); threeStack.Push(2, 40); threeStack.Push(3, 50); threeStack.Push(3, 60); for (int i = 0; i < 100; i++) { Assert.AreEqual(20, threeStack.Peek(1)); } }
public void _3_1_ThreeStack_withValidOperations_ShouldPopSuccessfully() { ThreeStackFixedSize threeStack = new ThreeStackFixedSize(2); threeStack.Push(1, 10); threeStack.Push(1, 20); threeStack.Push(2, 30); threeStack.Push(2, 40); threeStack.Push(3, 50); threeStack.Push(3, 60); Assert.AreEqual(20, threeStack.Pop(1)); Assert.AreEqual(10, threeStack.Pop(1)); Assert.AreEqual(40, threeStack.Pop(2)); Assert.AreEqual(30, threeStack.Pop(2)); Assert.AreEqual(60, threeStack.Pop(3)); Assert.AreEqual(50, threeStack.Pop(3)); }