public void AddRange_WithStringContainingNewLine_ShouldReplaceNewLineWithWhiteSpace() { MarkdownTableRow tableRow = new MarkdownTableRow(2); tableRow.AddRange(new [] { "A\nB", "C" }); Assert.AreEqual("|A B|C|", tableRow.Print()); }
public void Print_WithOneColumn_ShouldPrintCorrectMarkdownFormat() { MarkdownTableRow tableRow = new MarkdownTableRow(); tableRow.Add("Test"); Assert.AreEqual("|Test|", tableRow.Print()); }
public void TestGetRowAt() { var table = new MarkdownTable(new MarkdownTableHeader(3)); var row = new MarkdownTableRow("A", "B", "C"); table.AddRow(row); Assert.Equal(row, table.GetRowAt(0)); }
public void Print_WithTwoColumnsAndCapacityTwo_ShouldPrintCorrectMarkdownFormat() { MarkdownTableRow tableRow = new MarkdownTableRow(2); tableRow.Add("A"); tableRow.Add("B"); Assert.AreEqual("|A|B|", tableRow.Print()); }
public void Print_WithThreeColumnsAndCapacityTwo_ShouldThrowException() { MarkdownTableRow tableRow = new MarkdownTableRow(2); tableRow.Add("A"); tableRow.Add("B"); tableRow.Add("C"); Assert.AreEqual("|A|B|", tableRow.Print()); }
public void Print_WithThreeColumnsMiddleOneEmpty_ShouldPrintCorrectMarkdownFormat() { MarkdownTableRow tableRow = new MarkdownTableRow(); tableRow.Add("A"); tableRow.Add(string.Empty); tableRow.Add("C"); Assert.AreEqual("|A||C|", tableRow.Print()); }
internal static MarkdownTable ToMDTable(DotNetCommentTable commentTable) { MarkdownTable markdownTable = new MarkdownTable(); foreach (DotNetCommentRow commentRow in commentTable.Rows) { MarkdownTableRow markdownRow = ToMDTableRow(commentRow); markdownTable.Add(markdownRow); } return(markdownTable); }
protected virtual MarkdownTable GenerateCommandParameterTable([NotNull] CommandInformation command) { var parameterTable = new MarkdownTable(); parameterTable.AppendColumn(new MarkdownTableColumn("Name")); parameterTable.AppendColumn(new MarkdownTableColumn("Type")); parameterTable.AppendColumn(new MarkdownTableColumn("Optional")); foreach (var parameter in command.Parameters) { var row = new MarkdownTableRow() .AppendCell(new MarkdownText(parameter.Name)) .AppendCell(new MarkdownText(parameter.ParameterType.Humanize())) .AppendCell(new MarkdownInlineCode(parameter.IsOptional ? "yes" : "no")); parameterTable.AppendRow(row); } return(parameterTable); }
public void Print_WithoutEntry_ShouldReturnEmptyString() { MarkdownTableRow tableRow = new MarkdownTableRow(); Assert.AreEqual(string.Empty, tableRow.Print()); }