Exemple #1
0
        public IActionResult PreviewDraft(int draftId)
        {
            var post  = new BlogPostPublished();
            var draft = blogRepository.GetDraftById(draftId);

            post.PublishDraftToPost(draft);
            BlogPostViewModel postModel = new BlogPostViewModel
            {
                Post = post
            };

            return(View("BlogPost", postModel));
        }
Exemple #2
0
        public void PublishDraftToPost_RetainsValues()
        {
            string title   = "Some Example Title";
            string content = "Some Example Full Content";
            string author  = "Steven Jobison";

            var draft = new BlogPostDraft
            {
                PageTitle   = title,
                Author      = author,
                FullContent = content
            };

            var post = new BlogPostPublished();

            post.PublishDraftToPost(draft);

            Assert.AreEqual(title, post.PageTitle);
            Assert.AreEqual(content, post.FullContent);
            Assert.AreEqual(author, post.Author);
        }