예제 #1
0
        public void TestAllPushes(int[] input, int expected)
        {
            var sut = new MaxStack();

            foreach (int value in input)
            {
                sut.Push(value);
            }

            int actual = sut.GetMax();

            Assert.Equal(expected, actual);
        }
예제 #2
0
        public void TestPushPop()
        {
            var sut = new MaxStack();

            sut.Push(1);
            sut.Push(2);
            sut.Push(3);
            Assert.Equal(3, sut.GetMax());
            sut.Pop();
            Assert.Equal(2, sut.GetMax());
            sut.Push(99);
            sut.Push(33);
            Assert.Equal(99, sut.GetMax());
            sut.Pop();
            Assert.Equal(99, sut.GetMax());
            sut.Pop();
            Assert.Equal(2, sut.GetMax());
        }