Exemplo n.º 1
0
        public void DoesIsEmptyReturnsTrueWhenStackIsEmpty()
        {
            LinkedListTypedStack stack = new LinkedListTypedStack();
            bool expected = true;
            bool actual   = stack.IsEmpty();

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void DoesIsEmptyReturnsFaleWhenStackIsNotEmpty() // Depends on push() method
        {
            LinkedListTypedStack stack = new LinkedListTypedStack();

            stack.Push(1);

            bool expected = false;
            bool actual   = stack.IsEmpty();

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        public void DoesPopMethodRetrieveTopWhenStackHasOnlyOneElement()
        {
            LinkedListTypedStack stack = new LinkedListTypedStack();

            stack.Push(1);

            int expected = 1;
            int actual   = ((Node)stack.Pop()).Data;

            Assert.AreEqual(expected, actual);

            Assert.AreEqual(true, stack.IsEmpty());
            Assert.IsNull(stack.Top);
        }