Пример #1
0
        public void Peek_OnEmptyStack_ReturnExceptionMessage()
        {
            Stack testStack = new Stack();
            string expected = "Stack is empty.";
            string actual = testStack.Peek();

            Assert.AreEqual(expected, actual);
        }
Пример #2
0
        public void IsEmpty_OnEmptyStack_ReturnTrue()
        {
            Stack emptyStack = new Stack();
            bool expected = true;
            bool actual = emptyStack.IsEmpty();

            Assert.AreEqual(expected, actual);
        }
Пример #3
0
        public void Peek_OnPopulatedStack_ReturnString()
        {
            Node testNode = new Node("test");
            Stack testStack = new Stack();
            testStack.Push(testNode);
            string expected = "test";
            string actual = testStack.Peek();

            Assert.AreEqual(expected, actual);
        }
Пример #4
0
        public void IsEmpty_OnStackWithOneString_ReturnFalse()
        {
            Node testNode = new Node("Test");
            Stack testStack = new Stack();
            testStack.Push(testNode);
            bool expected = false;
            bool actual = testStack.IsEmpty();

            Assert.AreEqual(expected, actual);
        }
Пример #5
0
        public void IsEmpty_OnNewlyEmptyStack_ReturnTrue()
        {
            Node testNode = new Node("Test");
            Stack testStack = new Stack();
            testStack.Push(testNode);
            testStack.Pop();
            bool expected = true;
            bool actual = testStack.IsEmpty();

            Assert.AreEqual(expected, actual);
        }
Пример #6
0
        public Form1()
        {
            InitializeComponent();

            stack = new Stack();
        }