Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }