Пример #1
0
 private static void ShowGroup(NntpGroup group)
 {
     Console.WriteLine($"Group: {group.Name}");
     Console.WriteLine($"Article count: {group.ArticleCount}");
     Console.WriteLine($"Low water mark: {group.LowWaterMark}");
     Console.WriteLine($"High water mark: {group.HighWaterMark}");
     Console.WriteLine($"Posting status: {group.PostingStatus}");
     foreach (int articleNumber in group.ArticleNumbers)
     {
         Console.Write(articleNumber);
         Console.Write(" ");
     }
     Console.WriteLine();
 }
Пример #2
0
        private static void TestArticle(NntpClient client, NntpGroup @group)
        {
            // get article by message id
            ShowArticle(client.Article("<*****@*****.**>").Article);

            // select group alt.test.clienttest with article numbers            
            ShowGroup(client.ListGroup("alt.test.clienttest").Group);

            // get first article in group
            ShowArticle(client.Article().Article);

            // get last article in group
            ShowArticle(client.Article(@group.HighWaterMark).Article);
        }
Пример #3
0
        private static void TestDecompression(NntpClient client, NntpGroup @group)
        {
            // enable gzip
            client.XfeatureCompressGzip(false);

            // xzhdr
            ShowLines(client.Xzhdr("Subject", @group.LowWaterMark, @group.HighWaterMark).Lines);

            // xzver
            ShowLines(client.Xzver(@group.HighWaterMark, @group.HighWaterMark).Lines);

            //TestListDistributions(client);
            TestListActive(client);
            //TestNewGroups(client);

        }
Пример #4
0
        public void NntpGroupShouldBeSerializedAndDeserializedCorrectly(
            string name,
            int articleCount,
            int lowWaterMark,
            int highWaterMark,
            NntpPostingStatus postingStatus,
            string otherGroup,
            int[] articleNumbers)
        {
            var expected = new NntpGroup(
                name,
                articleCount,
                lowWaterMark,
                highWaterMark,
                postingStatus,
                otherGroup,
                articleNumbers);

            string json   = JsonConvert.SerializeObject(expected);
            var    actual = JsonConvert.DeserializeObject <NntpGroup>(json);

            Assert.Equal(expected, actual);
        }
Пример #5
0
 private static void TestXover(NntpClient client, NntpGroup group)
 {
     // xover
     ShowLines(client.Xover(NntpArticleRange.Range(group.HighWaterMark, group.HighWaterMark)).Lines);
 }
Пример #6
0
 private static void TestXhdr(NntpClient client, NntpGroup group)
 {
     // xhdr
     ShowLines(client.Xhdr("Subject", NntpArticleRange.Range(group.HighWaterMark, group.HighWaterMark)).Lines);
 }
Пример #7
0
 /// <summary>
 /// Creates a new instance of the <see cref="NntpGroupResponse"/> class.
 /// </summary>
 /// <param name="code">The response code received from the server.</param>
 /// <param name="message">The response message received from the server.</param>
 /// <param name="success">A value indicating whether the command succeeded or failed.</param>
 /// <param name="group">The <see cref="NntpGroup"/> received from the server.</param>
 public NntpGroupResponse(int code, string message, bool success, NntpGroup group)
     : base(code, message, success)
 {
     Group = group;
 }