예제 #1
0
        public void TestTwoDocuments()
        {
            String docs =
                "<mediawiki>\r\n" +
                PAGE1 +
                PAGE2 +
                "</mediawiki>";

            EnwikiContentSource source = createContentSource(docs, false);

            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");


            assertNoMoreDataException(source);
        }
예제 #2
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
            }
        }
예제 #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();
        }