예제 #1
0
        public void Pop_EmptyStack_ThrowsException()
        {
            var stack = new ArrayStack <int>();

            Assert.Throws <InvalidOperationException>(() =>
            {
                stack.Pop();
            });
        }
예제 #2
0
        public void Peek_PushTwoItemsAndPop_ReturnsHeadElement()
        {
            var stack = new ArrayStack <int>();

            stack.Push(1);
            stack.Push(2);

            stack.Pop();

            Assert.AreEqual(1, stack.Peek());
        }