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()); }
public override void EndElement(XElement element) { Debug.WriteLine($"</{element.Value}>"); conv.EndElement(xpath, element); xpath.Pop(); conventionStack.Pop(); moduleStack.Pop(); conv = moduleStack.Current; }
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 } }