예제 #1
0
        public void TestCurrent()
        {
            CMLStack stack = new CMLStack();

            stack.Push("first");
            Assert.AreEqual("first", stack.Peek());
            stack.Push("second");
            Assert.AreEqual("second", stack.Peek());
            stack.Push("third");
            Assert.AreEqual("third", stack.Peek());
            stack.Pop();
            Assert.AreEqual("second", stack.Peek());
            stack.Pop();
            Assert.AreEqual("first", stack.Peek());
        }
예제 #2
0
 public override void EndElement(XElement element)
 {
     Debug.WriteLine($"</{element.Value}>");
     conv.EndElement(xpath, element);
     xpath.Pop();
     conventionStack.Pop();
     moduleStack.Pop();
     conv = moduleStack.Current;
 }
예제 #3
0
        public void TestPop()
        {
            CMLStack stack = new CMLStack();

            stack.Push("first");
            stack.Push("second");
            stack.Push("third");
            Assert.AreEqual("third", stack.Pop());
            Assert.AreEqual("second", stack.Pop());
            Assert.AreEqual("first", stack.Pop());
            try
            {
                Assert.AreEqual("doesNotExist", stack.Pop());
                Assert.Fail("Should have received an ArrayIndexOutOfBoundsException");
            }
            catch (Exception)
            {
                // OK, should happen
            }
        }