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

            stack.Push(first);
            Assert.AreEqual(first, stack.Current);
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
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
            }
        }