Exemplo n.º 1
0
        public void ArticleShouldBeWrittenCorrectly(XSerializable <NntpArticle> article, string[] expectedLines)
        {
            var connection = new MockConnection();

            ArticleWriter.Write(connection, article.Object);
            Assert.Equal(expectedLines, connection.GetLines());
        }
Exemplo n.º 2
0
        /// <summary>
        /// The <a href="https://tools.ietf.org/html/rfc3977#section-6.3.2">IHAVE</a> command
        /// informs the server that the client has an article with the specified message-id.
        /// </summary>
        public bool Ihave(NntpArticle article)
        {
            NntpResponse initialResponse = connection.Command("IHAVE", new ResponseParser(335));

            if (!initialResponse.Success)
            {
                return(false);
            }
            ArticleWriter.Write(connection, article);
            NntpResponse subsequentResponse = connection.GetResponse(new ResponseParser(235));

            return(subsequentResponse.Success);
        }