Пример #1
0
        private void assertNoMoreDataException(EnwikiContentSource stdm)
        {
            try
            {
                stdm.GetNextDocData(null);
                fail("Expecting NoMoreDataException");
            }
#pragma warning disable 168
            catch (NoMoreDataException e)
#pragma warning restore 168
            {
                // expected
            }
        }
Пример #2
0
        public void TestOneDocument()
        {
            String docs =
                "<mediawiki>\r\n" +
                PAGE1 +
                "</mediawiki>";

            EnwikiContentSource source = createContentSource(docs, false);

            DocData dd = source.GetNextDocData(new DocData());

            assertDocData(dd, "1", "Title1", "Some text 1 here", "14-SEP-2011 11:35:09.000");


            assertNoMoreDataException(source);
        }
Пример #3
0
        public void TestForever()
        {
            String docs =
                "<mediawiki>\r\n" +
                PAGE1 +
                PAGE2 +
                "</mediawiki>";

            EnwikiContentSource source = createContentSource(docs, true);

            // same documents several times
            for (int i = 0; i < 3; i++)
            {
                DocData dd1 = source.GetNextDocData(new DocData());
                assertDocData(dd1, "1", "Title1", "Some text 1 here", "14-SEP-2011 11:35:09.000");

                DocData dd2 = source.GetNextDocData(new DocData());
                assertDocData(dd2, "2", "Title2", "Some text 2 here", "14-SEP-2022 22:35:09.000");
                // Don't test that NoMoreDataException is thrown, since the forever flag is turned on.
            }

            source.Dispose();
        }
Пример #4
0
 public Parser(EnwikiContentSource outerInstance)
 {
     this.outerInstance = outerInstance;
 }