Пример #1
0
        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));
        }
Пример #2
0
        public void TestCurrent()
        {
            CMLModuleStack stack = new CMLModuleStack();
            ICMLModule     first = new CMLCoreModule((IChemFile)null);

            stack.Push(first);
            Assert.AreEqual(first, stack.Current);
        }
Пример #3
0
        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));
            }
        }
Пример #4
0
        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
            }
        }
Пример #5
0
 public override void StartDocument()
 {
     conv.StartDocument();
     conventionStack.Push("CML");
     moduleStack.Push(conv);
 }