コード例 #1
0
        public override int Run(string[] remainingArguments)
        {
            _wpWrapper = LoginInfo.GetWordPressClient();

            #region Posts
            //create a new post
            var newPostID = createNewPost();

            //edit the post created above
            editPost(newPostID);

            //delete post created above
            _wpWrapper.DeletePost(newPostID);

            //get list of post status'
            var statusList = _wpWrapper.GetPostStatusList();
            #endregion

            #region Authors
            _wpWrapper.GetAuthors();
            #endregion

            #region Pages
            //create new page
            var newpageID = createPage();

            //get list of pages
            var pageList = _wpWrapper.GetPageList();

            //delete page
            var pageHasBeenDeleted = _wpWrapper.DeletePage(newpageID);

            //get page (using the ID from the page created above)
            var page = _wpWrapper.GetPage(newpageID);

            //todo: edit page
            #endregion

            #region Category

            //create a category
            var description = "This is a test description";
            var name = "Alex Cat";
            var slug = "testSlug";

            var catID = _wpWrapper.NewCategory(description, null, name, slug);

            var cats = _wpWrapper.GetCategories();

            var deletedCat = _wpWrapper.DeleteCategory(catID);
            #endregion

            #region Comments
            //create a new post
            var newPostForComment = createNewPost();

            var authorEmail = "*****@*****.**";
            var authorName = "Joe Blogs";
            var content = "This is a bit of text for the comment";
            var authorUrl = "www.alexjamesbrown.com";

            //add a comment to this post
            _wpWrapper.NewComment(newPostForComment, null, content, authorName, authorUrl, authorEmail);

            #endregion

            return 0;
        }
コード例 #2
0
ファイル: TestAllCommand.cs プロジェクト: zidad/JoeBlogs
        public override int Run(string[] remainingArguments)
        {
            _wpWrapper = LoginInfo.GetWordPressClient();

            #region Posts
            //create a new post
            var newPostID = createNewPost();

            //edit the post created above
            editPost(newPostID);

            //delete post created above
            _wpWrapper.DeletePost(newPostID);

            //get list of post status'
            var statusList = _wpWrapper.GetPostStatusList();
            #endregion

            #region Authors
            _wpWrapper.GetAuthors();
            #endregion

            #region Pages
            //create new page
            var newpageID = createPage();

            //get list of pages
            var pageList = _wpWrapper.GetPageList();

            //delete page
            var pageHasBeenDeleted = _wpWrapper.DeletePage(newpageID);

            //get page (using the ID from the page created above)
            var page = _wpWrapper.GetPage(newpageID);

            //todo: edit page
            #endregion

            #region Category

            //create a category
            var description = "This is a test description";
            var name        = "Alex Cat";
            var slug        = "testSlug";

            var catID = _wpWrapper.NewCategory(description, null, name, slug);

            var cats = _wpWrapper.GetCategories();

            var deletedCat = _wpWrapper.DeleteCategory(catID);
            #endregion

            #region Comments
            //create a new post
            var newPostForComment = createNewPost();

            var authorEmail = "*****@*****.**";
            var authorName  = "Joe Blogs";
            var content     = "This is a bit of text for the comment";
            var authorUrl   = "www.alexjamesbrown.com";

            //add a comment to this post
            _wpWrapper.NewComment(newPostForComment, null, content, authorName, authorUrl, authorEmail);

            #endregion

            return(0);
        }