public void CreateElement_FromIDocumentCodeBlockContent_ShouldReturnInstanceOfMarkdownChapterString()
        {
            MarkdownElementFactory factory = new MarkdownElementFactory();

            IPrintableDocumentCodeBlock chapterStringContent =
                factory.CreateElement <IPrintableDocumentCodeBlock>();

            Assert.IsInstanceOfType(chapterStringContent, typeof(MarkdownCodeBlock));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Append a section to the documentation containing the targets examples by using the
        /// xml based help. Therefore all examples are appended a code block.
        /// </summary>
        /// <param name="targetOverviewDocument">Document the section should be appended to.</param>
        /// <param name="target">The target for which the section should be created.</param>
        private void AppendExampleSection(IPrintableDocument targetOverviewDocument,
                                          IMsBuildTarget target)
        {
            if (target.Help.ContainsSection(MsBuildHelpSections.Example, StringComparison.OrdinalIgnoreCase) == false)
            {
                return;
            }

            foreach (IMsBuildElementHelpParagraph exampleHelpParagraph in target.Help.LookUp(
                         MsBuildHelpSections.Example, StringComparison.OrdinalIgnoreCase))
            {
                IPrintableDocumentChapter exampleChapter =
                    targetOverviewDocument.AddNewChapter(MsBuildHelpSections.Example);

                IPrintableDocumentCodeBlock exampleCodeBlock =
                    exampleChapter.AddNewContent <IPrintableDocumentCodeBlock>();

                var codeBlock = MsBuildElementHelpCodeBlockUtility.Parse(exampleHelpParagraph.Content);

                exampleCodeBlock.AppendContentLine(codeBlock.Content);
                exampleCodeBlock.SetLanguage(codeBlock.Language.ToString());
            }
        }