public void ContributorsAreAppendedForAWellFormedContributorsTemplate() { var inputLines = new[] { "# Awesome App", "", "This app is lovingly crafted by lots of awesome folks!", "", "## Contributors", "", "[//]: # (ThankYouBlockStart)", "[//]: # \"ThankYouTemplate:- @name)", "- gandalf", "[//]: # (ThankYouBlockEnd)" }; var contributors = new[] { new Contributor("boromir", "twitch") }; var outputLines = MarkdownProcessor.AddContributorsToMarkdownFile(inputLines, contributors).ToArray(); var expectedOutputLines = new[] { "# Awesome App", "", "This app is lovingly crafted by lots of awesome folks!", "", "## Contributors", "", "[//]: # (ThankYouBlockStart)", "[//]: # \"ThankYouTemplate:- @name)", "- gandalf", "- boromir", "[//]: # (ThankYouBlockEnd)" }; AssertCollectionsAreEqual(expectedOutputLines, outputLines); }
public void FilesWithNoTemplateAreNotChanged() { var inputLines = new[] { "# Secret App", "", "This is a secret app with no contributors." }; var contributors = new[] { new Contributor("new", "twitch") }; var outputLines = MarkdownProcessor.AddContributorsToMarkdownFile(inputLines, contributors).ToArray(); AssertCollectionsAreEqual(inputLines, outputLines); }
public void ContributorsThatDifferOnlyInCaseAreConsideredDuplicates() { var inputLines = new[] { "# Awesome App", "", "This app is lovingly crafted by lots of awesome folks!", "", "## Contributors", "", "[//]: # (ThankYouBlockStart)", "[//]: # \"ThankYouTemplate:- @name)", "- frodo", "[//]: # (ThankYouBlockEnd)" }; var contributors = new[] { "Frodo", "froDo" }; var outputLines = MarkdownProcessor.AddContributorsToMarkdownFile(inputLines, contributors).ToArray(); AssertCollectionsAreEqual(inputLines, outputLines); }
public void DuplicateContributorsAreNotAdded() { var inputLines = new[] { "# Awesome App", "", "This app is lovingly crafted by lots of awesome folks!", "", "## Contributors", "", "[//]: # (ThankYouBlockStart)", "[//]: # \"ThankYouTemplate:- @name)", "- frodo", "[//]: # (ThankYouBlockEnd)" }; var contributors = new[] { new Contributor("frodo", "twitch") }; var outputLines = MarkdownProcessor.AddContributorsToMarkdownFile(inputLines, contributors).ToArray(); AssertCollectionsAreEqual(inputLines, outputLines); }