예제 #1
0
        public virtual void testGetMessageElement()
        {
            JDFDoc     d   = new JDFDoc("JMF");
            JDFJMF     jmf = d.getJMFRoot();
            JDFCommand c   = (JDFCommand)jmf.appendMessageElement(EnumFamily.Command, EnumType.Events);

            Assert.AreEqual(c, jmf.getMessageElement(EnumFamily.Command, EnumType.Events, 0));
            jmf.appendComment();

            JDFSignal s = (JDFSignal)jmf.appendMessageElement(EnumFamily.Signal, EnumType.Events);

            Assert.AreEqual(s, jmf.getMessageElement(EnumFamily.Signal, EnumType.Events, 0));
            Assert.AreEqual(s, jmf.getMessageElement(null, EnumType.Events, 1));
            Assert.AreEqual(s, jmf.getMessageElement(null, null, 1));

            JDFSignal s2 = (JDFSignal)jmf.appendMessageElement(EnumFamily.Signal, EnumType.Status);

            Assert.AreEqual(s2, jmf.getMessageElement(EnumFamily.Signal, EnumType.Status, 0));
            Assert.AreEqual(s2, jmf.getMessageElement(EnumFamily.Signal, null, 1));
            Assert.AreEqual(s2, jmf.getMessageElement(null, null, 2));
            Assert.AreEqual(s2, jmf.getMessageElement(null, null, -1));
            Assert.AreEqual(s, jmf.getMessageElement(null, null, -2));
            Assert.AreEqual(c, jmf.getMessageElement(null, null, -3));
            Assert.IsNull(jmf.getMessageElement(null, null, -4));
        }