Exemple #1
0
        public void IsEmptyTestOnEmptyStack()
        {
            Stack testStack = new Stack();

            bool expected = true;

            bool actual = testStack.IsEmpty();

            Assert.AreEqual(expected, actual);
        }
Exemple #2
0
        public void CountTestOnEmptyStack()
        {
            Stack testStack = new Stack();

            int expected = 0;

            int actual = testStack.Count();

            Assert.AreEqual(expected, actual);
        }
Exemple #3
0
        public void IsEmptyTestOnPreviouslyPopulatedStackNowEmpty()
        {
            Stack testStack = new Stack();
            StringNode testString1 = new StringNode();
            StringNode testString2 = new StringNode();
            testString1.Value = "Test String 1";
            testString2.Value = "Test String 2";

            bool expected = true;

            testStack.Push(testString1);
            testStack.Push(testString2);
            testStack.Pop();
            testStack.Pop();

            bool actual = testStack.IsEmpty();

            Assert.AreEqual(expected, actual);
        }
Exemple #4
0
        public void CountTestOnPreviouslyPoplulatedStack()
        {
            Stack testStack = new Stack();
            StringNode testString1 = new StringNode();
            StringNode testString2 = new StringNode();
            testString1.Value = "Test String 1";
            testString2.Value = "Test String 2";

            int expected = 0;

            testStack.Push(testString1);
            testStack.Push(testString2);
            testStack.Pop();
            testStack.Pop();

            int actual = testStack.Count();

            Assert.AreEqual(expected, actual);
        }
Exemple #5
0
        public void PopTestOnEmptyStack()
        {
            Stack testStack = new Stack();

            testStack.Pop();
        }
Exemple #6
0
        public void PeekTestOnPreviouslyPoplulatedStack()
        {
            Stack testStack = new Stack();
            StringNode testString1 = new StringNode();
            StringNode testString2 = new StringNode();
            testString1.Value = "Test String 1";
            testString2.Value = "Test String 2";

            testStack.Push(testString1);
            testStack.Push(testString2);
            testStack.Pop();
            testStack.Pop();

            string actual = testStack.Peek();
        }
Exemple #7
0
        public void PeekTestOnPopulatedStack()
        {
            Stack testStack = new Stack();
            StringNode testString1 = new StringNode();
            StringNode testString2 = new StringNode();
            StringNode testString3 = new StringNode();

            testString1.Value = "Test String 1";
            testString2.Value = "Test String 2";
            testString3.Value = "Test String 3";

            bool expected = true;

            testStack.Push(testString1);
            testStack.Push(testString2);
            testStack.Push(testString3);

            String testPeek = testStack.Peek();
            String testStringStillExists = testStack.Peek();
            bool actual = (testPeek == testString3.Value && testStringStillExists == testString3.Value);

            Assert.AreEqual(expected, actual);
        }
Exemple #8
0
        public void PeekTestOnEmptyStack()
        {
            Stack testStack = new Stack();

            String actual = testStack.Peek();
        }
Exemple #9
0
        public void IsEmptyTestOnStackWithItems()
        {
            Stack testStack = new Stack();
            StringNode testString1 = new StringNode();
            StringNode testString2 = new StringNode();
            testString1.Value = "Test String 1";
            testString2.Value = "Test String 2";

            bool expected = false;

            testStack.Push(testString1);
            testStack.Push(testString2);

            bool actual = testStack.IsEmpty();

            Assert.AreEqual(expected, actual);
        }