public void GetPostConfigFromMarkdown()
        {
            string markdown = MarkdownWithoutPostId;

            var addin = new WeblogAddin.WebLogAddin();
            var meta  = addin.GetPostConfigFromMarkdown(markdown);

            Console.WriteLine(JsonConvert.SerializeObject(meta, Formatting.Indented));

            Assert.IsTrue(meta.Abstract == "Abstract");
            Assert.IsTrue(meta.Keywords == "Keywords");
            Assert.IsTrue(meta.WeblogName == "WebLogName");
        }
示例#2
0
        public void SetConfigInMarkdown()
        {
            var meta = new WeblogPostMetadata()
            {
                Abstract        = "THis is an abstract",
                Keywords        = "Security,SSL,IIS",
                RawMarkdownBody = MarkdownWithoutPostId,
                PostId          = "2",
                WeblogName      = "Rick Strahl's Web Log"
            };

            var    addin    = new WeblogAddin.WebLogAddin();
            string markdown = addin.SetConfigInMarkdown(meta);

            Console.WriteLine(markdown);
            Assert.IsTrue(markdown.Contains("<postid>2</postid>"), "Post Id wasn't added");
        }
示例#3
0
        public void GetPostConfigFromMarkdown()
        {
            WeblogInfo weblogInfo = WeblogAddinConfiguration.Current.Weblogs[ConstWeblogName];
            Post       post       = new Post()
            {
            };

            string markdown = MarkdownWithoutPostId;

            var addin = new WeblogAddin.WebLogAddin();
            var meta  = WeblogPostMetadata.GetPostConfigFromMarkdown(markdown, post, weblogInfo);

            Console.WriteLine("meta: \r\n" + JsonConvert.SerializeObject(meta, Formatting.Indented));

            Console.WriteLine("post: \r\n" + JsonConvert.SerializeObject(post, Formatting.Indented));

            Assert.IsTrue(meta.Abstract == "Abstract");
            Assert.IsTrue(meta.Keywords == "Keywords");
            Assert.IsTrue(meta.WeblogName == "WebLogName");
        }