public void Format_TextWriter_Null_Exception()
        {
            // act & assert
            var exception = Assert.Throws <ArgumentNullException>(() => SemanticReleaseNotesFormatter.Format(null, new ReleaseNotes()));

            Assert.Equal("writer", exception.ParamName);
        }
        public void Format_ExampleA_Default()
        {
            // act
            var resultHtml = SemanticReleaseNotesFormatter.Format(GetExampleAReleaseNotes());

            // assert
            Assert.Equal(ExampleAHtml, resultHtml.Trim());
        }
        public void Format_ExampleC_Output_Markdown_GroupBy_Categories()
        {
            // act
            var resultMarkdown = SemanticReleaseNotesFormatter.Format(GetExampleCReleaseNotes(), new SemanticReleaseNotesConverterSettings {
                OutputFormat = OutputFormat.Markdown, GroupBy = GroupBy.Categories
            });

            // assert
            Assert.Equal(ExampleCMarkdownCategories, resultMarkdown.Trim());
        }
        public void Format_ExampleA_Output_Markdown_Custom_LiquidTemplate()
        {
            // act
            var resultMarkdown = SemanticReleaseNotesFormatter.Format(GetExampleAReleaseNotes(), new SemanticReleaseNotesConverterSettings {
                OutputFormat = OutputFormat.Markdown, LiquidTemplate = CustomLiquidTemplate
            });

            // assert
            Assert.Equal(CustomLiquidTemplateMarkdown, resultMarkdown.Trim());
        }
        public void Format_ExampleD_Output_Html()
        {
            // act
            var resultHtml = SemanticReleaseNotesFormatter.Format(GetExampleDReleaseNotes(), new SemanticReleaseNotesConverterSettings {
                OutputFormat = OutputFormat.Html
            });

            // assert
            Assert.Equal(ExampleDHtml, resultHtml.Trim());
        }
        public void Format_ExampleA_Output_Markdown_PluralizeCategoriesTitle()
        {
            // act
            var resultMarkdown = SemanticReleaseNotesFormatter.Format(GetExampleABisReleaseNotes(), new SemanticReleaseNotesConverterSettings {
                OutputFormat = OutputFormat.Markdown, GroupBy = GroupBy.Categories, PluralizeCategoriesTitle = true
            });

            // assert
            Assert.Equal(ExampleABisMarkdownCategories, resultMarkdown.Trim());
        }
        public void Format_ExampleA_Output_Html_GroupBy_Categories()
        {
            // act
            var resultHtml = SemanticReleaseNotesFormatter.Format(GetExampleAReleaseNotes(), new SemanticReleaseNotesConverterSettings {
                OutputFormat = OutputFormat.Html, GroupBy = GroupBy.Categories
            });

            // assert
            Assert.Equal(ExampleAHtmlCategories, resultHtml.Trim());
        }
        public void Format_ExampleA_Output_Markdown()
        {
            // act
            var resultMarkdown = SemanticReleaseNotesFormatter.Format(GetExampleAReleaseNotes(), new SemanticReleaseNotesConverterSettings {
                OutputFormat = OutputFormat.Markdown
            });

            // assert
            Assert.Equal(ExampleAMarkdown, resultMarkdown.Trim());
        }
        public void Format_ExampleA_Output_Html_With_DefaultStyle()
        {
            // act
            var resultHtml = SemanticReleaseNotesFormatter.Format(GetExampleAReleaseNotes(), new SemanticReleaseNotesConverterSettings {
                OutputFormat = OutputFormat.Html, IncludeStyle = true
            });

            // assert
            Assert.Equal(GetExampleAHtmlWithStyle(), resultHtml.Trim());
        }
        public void Format_SyntaxMetadataCommits_Output_Markdown()
        {
            // act
            var resultMarkdown = SemanticReleaseNotesFormatter.Format(GetSyntaxMetadataCommitsReleaseNotes(), new SemanticReleaseNotesConverterSettings {
                OutputFormat = OutputFormat.Markdown, GroupBy = GroupBy.Categories, PluralizeCategoriesTitle = true
            });

            // assert
            Assert.Equal(SyntaxMetadataCommitsMarkdown, resultMarkdown.Trim());
        }
        public void Format_TextWriter_ExampleA_Default()
        {
            // arrange
            var resultHtml = new StringBuilder();

            // act
            SemanticReleaseNotesFormatter.Format(new StringWriter(resultHtml), GetExampleAReleaseNotes());

            // assert
            Assert.Equal(ExampleAHtml, resultHtml.ToString().Trim());
        }
        public void Format_ExampleA_Output_Markdown_TextWriter()
        {
            // arrange
            var resultMarkdown = new StringBuilder();

            // act
            SemanticReleaseNotesFormatter.Format(new StringWriter(resultMarkdown), GetExampleAReleaseNotes(), new SemanticReleaseNotesConverterSettings {
                OutputFormat = OutputFormat.Markdown
            });

            // assert
            Assert.Equal(ExampleAMarkdown, resultMarkdown.ToString().Trim());
        }
        public void Format_ExampleA_Output_Html_WithCustomStyle()
        {
            // arrange
            var customStyle = "body { color:black; width:500px; }";

            // act
            var resultHtml = SemanticReleaseNotesFormatter.Format(GetExampleAReleaseNotes(), new SemanticReleaseNotesConverterSettings {
                OutputFormat = OutputFormat.Html, IncludeStyle = true, CustomStyle = customStyle
            });

            // assert
            Assert.Equal(GetExampleAHtmlWithStyle(customStyle), resultHtml.Trim());
        }
 /// <summary>
 /// Convert a raw semantic release notes to a formatted semantic release notes
 /// </summary>
 /// <param name="rawReleaseNotes">raw semantic release notes</param>
 /// <param name="settings">Settings used for converting</param>
 /// <returns>A formatted release notes</returns>
 public static string Convert(string rawReleaseNotes, SemanticReleaseNotesConverterSettings settings = null)
 {
     return(SemanticReleaseNotesFormatter.Format(Parser.SemanticReleaseNotesParser.Parse(rawReleaseNotes, settings), settings));
 }
 /// <summary>
 /// Format a release notes
 /// </summary>
 /// <param name="writer">TextWriter which will be used to writes the formatted release notes</param>
 /// <param name="releaseNotes">Release notes to format</param>
 /// <param name="settings">Settings used for formatting</param>
 public static void Format(TextWriter writer, ReleaseNotes releaseNotes, SemanticReleaseNotesConverterSettings settings = null)
 {
     SemanticReleaseNotesFormatter.Format(writer, releaseNotes, settings);
 }
 /// <summary>
 /// Convert a raw semantic release notes to a formatted semantic release notes
 /// </summary>
 /// <param name="reader">Reader of release notes</param>
 /// <param name="writer">TextWriter which will be used to writes the formatted release notes</param>
 /// <param name="settings">Settings used for converting</param>
 /// <returns>A formatted release notes</returns>
 public static void Convert(TextReader reader, TextWriter writer, SemanticReleaseNotesConverterSettings settings = null)
 {
     SemanticReleaseNotesFormatter.Format(writer, Parser.SemanticReleaseNotesParser.Parse(reader, settings), settings);
 }
 /// <summary>
 ///Format a release notes
 /// </summary>
 /// <param name="releaseNotes">Release notes to format</param>
 /// <param name="settings">Settings used for formatting</param>
 /// <returns>Formatted release notes</returns>
 public static string Format(ReleaseNotes releaseNotes, SemanticReleaseNotesConverterSettings settings = null)
 {
     return(SemanticReleaseNotesFormatter.Format(releaseNotes, settings));
 }