Пример #1
0
        public void XMLFragment_TestReaderXML6()
        {
            PDFXMLFragmentReader reader = null;

            try
            {
                reader = new PDFXMLFragmentReader(TestXml6_2, false, null);
                throw new ArgumentException("Required excpetion not thrown");
            }
            catch (PDFXmlFormatException ex)
            {
                TestContext.WriteLine("Successfully caught the exception from invalid xml : " + ex.Message);
            }


            if (reader != null)
            {
                try
                {
                    reader.Read();
                    throw new ArgumentException("Required exception not thrown");
                }
                catch (PDFXmlFormatException ex)
                {
                    TestContext.WriteLine("Successfully caught the exception from invalid xml : " + ex.Message);
                }
            }
        }
Пример #2
0
        public void XMLFragment_TestReaderXML5()
        {
            PDFXMLFragmentReader reader = new PDFXMLFragmentReader(TestXml5, false, null);
            int index = 0;

            while (reader.Read())
            {
                Assert.AreEqual(MatchXml5[index], reader.Value);
                Assert.AreEqual(MatchXml5[index].OpType, reader.OpType);
                index++;
            }
            Assert.IsTrue(reader.EOF);
        }
Пример #3
0
        public void XMLFragment_TestReaderXML3WithReset()
        {
            PDFXMLFragmentReader reader = new PDFXMLFragmentReader(TestXml3, false, null);
            int  index    = 0;
            bool hasreset = false;

            while (reader.Read())
            {
                Assert.AreEqual(MatchXml3[index], reader.Value);
                Assert.AreEqual(MatchXml3[index].OpType, reader.OpType);
                index++;
                if (index == 5 && hasreset == false)
                {
                    hasreset = true;
                    index    = 0;
                    reader.Reset();
                }
            }
            Assert.IsTrue(reader.EOF);
        }