Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
            }
        }