コード例 #1
0
        public void MoveArticleForwardAndBackward()
        {
            using (var client = new Rfc977NntpClient())
            {
                client.Connect(Server);
                client.ProtocolLogger = Console.Error;
                client.SelectNewsgroup(TestNewsGroup);

                var range = 3;

                Assert.Greater(client.CurrentGroup.EstimatedCount, range, "Article count may not be large enough, this might not be an error.");
                var count = 0;

                for (; count < range; count++)
                {
                    var ids = client.SetNextArticle();
                }

                for (; count > 0; count--)
                {
                    var ids = client.SetPreviousArticle();
                }
                Assert.AreEqual(0, count, "Should have backed up same count as forward.");
            }
        }
コード例 #2
0
        public void MoveArticleBackwardFromEnd()
        {
            using (var client = new Rfc977NntpClient())
            {
                client.Connect(Server);
                client.SelectNewsgroup(TestNewsGroup);
                client.RetrieveStatistics(client.CurrentGroup.LastArticleId);

                var range = 3;

                Assert.Greater(client.CurrentGroup.EstimatedCount, range, "Article count may not be large enough, this might not be an error.");
                var count = range;

                while (--count > 0)
                {
                    var ids = client.SetPreviousArticle();
                }
                Assert.AreEqual(0, count, "Should have backed up to 20 articles.");
            }
        }