Esempio n. 1
0
        public void Peek_ForNonEmptyStack_Success()
        {
            IBasicStack <int> stack = new BasicStack <int>(1);

            var itemValue = stack.Peek();

            Assert.Equal(1, itemValue);
        }
        public void FailPopOnEmpty()
        {
            var sut = new BasicStack <int>();

            // Assert
            Assert.Throws <InvalidOperationException>(() => sut.Peek());
            Assert.Throws <InvalidOperationException>(() => sut.Pop());
        }
Esempio n. 3
0
        public void Peek_ForEmptyStack_ThrowsException()
        {
            IBasicStack <int> stack = new BasicStack <int>();

            Assert.ThrowsAny <Exception>(() => stack.Peek());
        }