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

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

            Assert.IsInstanceOfType(chapterStringContent, typeof(MarkdownTable));
        }
Пример #2
0
        /// <summary>
        /// Append a section to the documentation containing the targets dependencies by using the
        /// MsBuild target attributes. Therefore all dependencies like "AfterTargets", "BeforeTargets"
        /// and "DependsOnTargets" are appended as a paragraph table.
        /// </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 AppendDependencySection(IPrintableDocument targetOverviewDocument,
                                             IMsBuildTarget target)
        {
            if (target.HasTargetDependencies == false)
            {
                return;
            }

            IPrintableDocumentChapter dependencyChapter =
                targetOverviewDocument.AddNewChapter("Target Dependencies");

            IPrintableParagraphTable dependencyTable =
                dependencyChapter.AddNewContent <IPrintableParagraphTable>()
                .WithHeaders("Target", "Dependency Type", "Dependency Description");

            foreach (var dependentOnTarget in target.DependsOnTargets)
            {
                dependencyTable.WithRow(dependentOnTarget, "DependsOnTargets",
                                        string.Format(CultureInfo.InvariantCulture,
                                                      "Calls the target {0} before execution of {1}.", dependentOnTarget, target.Name));
            }

            foreach (var afterTarget in target.AfterTargets)
            {
                dependencyTable.WithRow(afterTarget, "AfterTargets",
                                        string.Format(CultureInfo.InvariantCulture,
                                                      "Runs the target {0} after the execution of {1} has finished.", target.Name, afterTarget));
            }

            foreach (var beforeTargets in target.BeforeTargets)
            {
                dependencyTable.WithRow(beforeTargets, "BeforeTargets",
                                        string.Format(CultureInfo.InvariantCulture,
                                                      "Runs the target {0} before the execution of {1} starts.", target.Name, beforeTargets));
            }
        }