public void TestEndsWith_String() { CMLModuleStack stack = new CMLModuleStack(); ICMLModule first = new CMLCoreModule((IChemFile)null); stack.Push(first); Assert.IsTrue(stack.EndsWith(first)); ICMLModule second = new CMLCoreModule((IChemFile)null); stack.Push(second); Assert.IsTrue(stack.EndsWith(second)); }
public void TestCurrent() { CMLModuleStack stack = new CMLModuleStack(); ICMLModule first = new CMLCoreModule((IChemFile)null); stack.Push(first); Assert.AreEqual(first, stack.Current); }
public void TestPush_String() { // the class has a hardcoded default length. Test going beyond this. CMLModuleStack stack = new CMLModuleStack(); for (int i = 0; i < 100; i++) { stack.Push(new CMLCoreModule((IChemFile)null)); } }
public void TestPop() { CMLModuleStack stack = new CMLModuleStack(); ICMLModule first = new CMLCoreModule((IChemFile)null); ICMLModule second = new CMLCoreModule((IChemFile)null); ICMLModule third = new CMLCoreModule((IChemFile)null); 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 } }
public override void StartDocument() { conv.StartDocument(); conventionStack.Push("CML"); moduleStack.Push(conv); }