Пример #1
0
        public void can_map_to_comment_from_xmlRpcComment()
        {
            var statusEnum = CommentStatus.Approve;
            var statusEnumName = Enum.GetName(typeof(CommentStatus), statusEnum);

            var xmlRpcComment = new XmlRpcComment
                                    {
                                        author = "test author",
                                        author_email = "*****@*****.**",
                                        author_url = "www.test.com",
                                        parent = "0",
                                        content = "This is some test content",
                                        post_id = "234",
                                        status = "hold"
                                    };

            var result = Map.To.Comment(xmlRpcComment);

            Assert.AreEqual(xmlRpcComment.author, result.AuthorName);
            Assert.AreEqual(xmlRpcComment.author_email, result.AuthorEmail);
            Assert.AreEqual(xmlRpcComment.author_url, result.AuthorUrl);
            //Assert.AreEqual(xmlRpcComment.parent, result.ParentCommentID);
            Assert.AreEqual(xmlRpcComment.content, result.Content);
        }
Пример #2
0
        public void trying_to_map_a_string_that_doesnt_correspond_to_enum_val_throws_exception()
        {
            var testItem = new XmlRpcComment();

            Assert.Throws<ArgumentException>(() => Map.To.Comment(testItem));
        }
Пример #3
0
        /// <summary>
        /// Create new comment.
        /// </summary>
        /// <param name="postid"></param>
        /// <param name="comment"></param>
        /// <returns></returns>
        public string NewComment(int postid, int? comment_parent, string content, string author, string author_url, string author_email)
        {
            var xmlRpcComment = new XmlRpcComment
            {
                parent = Convert.ToString(comment_parent),
                content = content,
                author = author,
                author_url = author_url,
                author_email = author_email
            };

            var result = _wrapper.NewComment(this.BlogID, Username, Password, Convert.ToString(postid), xmlRpcComment);
            return Convert.ToString(result);
        }
Пример #4
0
        /// <summary>
        /// Edit comment.
        /// </summary>
        /// <param name="comment"></param>
        /// <returns></returns>
        public bool EditComment(string comment_id, CommentStatus status, DateTime date_created_gmt, string content, string author, string author_url, string author_email)
        {
            var xmlRpcComment = new XmlRpcComment
            {

                author = author,
                author_email = author_email,
                author_url = author_url,
                dateCreated = date_created_gmt,
                content = content,
                status = EnumsHelper.GetCommentStatusName(status)
            };

            return _wrapper.EditComment(this.BlogID, Username, Password, xmlRpcComment);
        }