コード例 #1
0
        public void Peek_An_Element_In_A_Stack_With_No_Element()
        {
            var stack = new StackMin();

            var item = stack.Peek();

            Assert.Equal(0, item);
            Assert.Equal(0, stack.Length);
            Assert.Null(stack.Top);
            Assert.Null(stack.Bottom);
            Assert.Equal(int.MaxValue, stack.Min());
        }
コード例 #2
0
        public void Peek_Element_In_A_Stack_With_One_Element()
        {
            var stack = new StackMin();

            stack.Push(20);

            var item = stack.Peek();

            Assert.Equal(20, item);
            Assert.Equal(1, stack.Length);
            Assert.Equal(20, stack.Top.Value);
            Assert.Equal(20, stack.Bottom.Value);
            Assert.Equal(20, stack.Min());
        }