Esempio n. 1
0
        public void TestCurrent()
        {
            CMLModuleStack stack = new CMLModuleStack();
            ICMLModule     first = new CMLCoreModule((IChemFile)null);

            stack.Push(first);
            Assert.AreEqual(first, stack.Current);
        }
Esempio n. 2
0
 /// <summary>
 /// Constructor for the CMLHandler.
 /// </summary>
 /// <param name="chemFile">The document in which data is stored</param>
 public CMLHandler(IChemFile chemFile)
 {
     conv            = new CMLCoreModule(chemFile);
     userConventions = new Dictionary <string, ICMLModule>();
     xpath           = new CMLStack();
     conventionStack = new CMLStack();
     moduleStack     = new CMLModuleStack();
 }
Esempio n. 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));
            }
        }
Esempio n. 4
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));
        }
Esempio n. 5
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
            }
        }