public void StackUsingArray1FixedSizeTestTwoItems()
        {
            // Create stack with capacity of 3.
            var st = new StackUsingArray1FixedSizeComplete <int>(3);

            // Check the count.
            Assert.AreEqual(0, st.Count);

            // Push & pop items.
            st.Push(1);
            st.Pop();
            st.Push(1);
            st.Push(2);
            st.Push(3);
            st.Pop();

            // Check the count.
            Assert.AreEqual(2, st.Count);

            // Peek at the top item.
            Assert.AreEqual(2, st.Peek());

            // Pop the item.
            Assert.AreEqual(2, st.Pop());

            // Check the count.
            Assert.AreEqual(1, st.Count);
        }
        public void StackUsingArray1FixedSizeTestPopEmptyStack()
        {
            // Create stack & push three items.
            var st = new StackUsingArray1FixedSizeComplete <int>(2);

            try
            {
                st.Pop();
            }
            catch (InvalidOperationException)
            {
                // Exception.
                Assert.IsTrue(true);
                return;
            }

            // No exception.
            Assert.Fail();
        }
        public void StackUsingArray1FixedSizeTestOneItem()
        {
            // Create stack with capacity of 1.
            var st = new StackUsingArray1FixedSizeComplete <int>(1);

            // Check the count.
            Assert.AreEqual(0, st.Count);

            // Push an item.
            st.Push(1);

            // Check the count.
            Assert.AreEqual(1, st.Count);

            // Peek at the item.
            Assert.AreEqual(1, st.Peek());

            // Pop the item.
            Assert.AreEqual(1, st.Pop());

            // Check the count.
            Assert.AreEqual(0, st.Count);
        }