Esempio n. 1
0
        public void Peek_PushTwoItems_ReturnsHeadItem()
        {
            var stack = new NodeStack <int>();

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

            Assert.AreEqual(2, stack.Peek());
        }
Esempio n. 2
0
        public void Count_PushOneItem_ReturnsOne()
        {
            var stack = new NodeStack <int>();

            stack.Push(1);

            Assert.AreEqual(1, stack.Count);
            Assert.IsFalse(stack.IsEmpty);
        }
Esempio n. 3
0
        public void Pop_EmptyStack_ThrowsException()
        {
            var stack = new NodeStack <int>();

            Assert.Throws <InvalidOperationException>(() =>
            {
                stack.Pop();
            });
        }
Esempio n. 4
0
        public void Peek_PushTwoItemAndPop_ReturnsHeadElement()
        {
            var stack = new NodeStack <int>();

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

            stack.Pop();

            Assert.AreEqual(1, stack.Peek());
        }
Esempio n. 5
0
        public void IsEmpty_EmptyStack_RetrunsTrue()
        {
            var stack = new NodeStack <int>();

            Assert.IsTrue(stack.IsEmpty);
        }