public void SimpleFormattingTests_RemoveBlankLinesBefore()
        {
            var input    = "\r\n\r\nLorem ipsum dolor sit amet.";
            var expected = "Lorem ipsum dolor sit amet.";

            CommentFormatHelper.AssertEqualAfterFormat(input, expected);
        }
        public void SimpleFormattingTests_RemovesLineBreaks()
        {
            var input    = "Lorem ipsum\r\ndolor sit amet.";
            var expected = "Lorem ipsum dolor sit amet.";

            CommentFormatHelper.AssertEqualAfterFormat(input, expected);
        }
        public void XmlFormattingTests_KeepCodeFormatting()
        {
            var input =
                "<test><code>" + Environment.NewLine +
                "some" + Environment.NewLine +
                "  code" + Environment.NewLine +
                "stuff" + Environment.NewLine +
                "</code></test>";

            var expected =
                "<test>" + Environment.NewLine +
                "<code>" + Environment.NewLine +
                "some" + Environment.NewLine +
                "  code" + Environment.NewLine +
                "stuff" + Environment.NewLine +
                "</code>" + Environment.NewLine +
                "</test>";

            CommentFormatHelper.AssertEqualAfterFormat(input, expected, new CodeCommentOptions(Settings.Default)
            {
                WrapAtColumn       = 100,
                XmlSplitSummaryTag = false,
                XmlSplitAllTags    = false
            });
        }
Beispiel #4
0
        public void XmlFormattingTests_BreakSummaryTags()
        {
            var input    = "<summary></summary><returns></returns>";
            var expected = "<summary>" + Environment.NewLine + "</summary>" + Environment.NewLine + "<returns></returns>";

            Settings.Default.Formatting_CommentXmlValueIndent = 0;
            CommentFormatHelper.AssertEqualAfterFormat(input, expected);
        }
        public void XmlFormattingTests_InterpunctionNoSpacing()
        {
            var input = "<test>Line with <interpunction/>.</test>";

            Settings.Default.Formatting_CommentXmlSpaceSingleTags = false;

            CommentFormatHelper.AssertEqualAfterFormat(input);
        }
Beispiel #6
0
        public void XmlFormattingTests_DoNotAutoExpandTags()
        {
            var input = "<summary/>";

            Settings.Default.Formatting_CommentXmlSplitSummaryTagToMultipleLines = false;

            CommentFormatHelper.AssertEqualAfterFormat(input);
        }
Beispiel #7
0
        public void XmlFormattingTests_RemoveSpaceFromTagContent()
        {
            var input    = "<summary> <c> test </c> </summary>";
            var expected = "<summary><c>test</c></summary>";

            Settings.Default.Formatting_CommentXmlSplitSummaryTagToMultipleLines = false;

            CommentFormatHelper.AssertEqualAfterFormat(input, expected);
        }
        public void SimpleFormattingTests_PreservesSingleBlankLine()
        {
            var input = "Lorem ipsum\r\n\r\ndolor sit amet.";

            CommentFormatHelper.AssertEqualAfterFormat(input, new CodeCommentOptions()
            {
                WrapAtColumn = 100,
            });
        }
        public void SimpleFormattingTests_WrapsLinesAsExpected()
        {
            var input    = "Lorem ipsum dolor sit.";
            var expected = "Lorem ipsum\r\ndolor sit.";

            Settings.Default.Formatting_CommentWrapColumn = 12;

            CommentFormatHelper.AssertEqualAfterFormat(input, expected);
        }
Beispiel #10
0
        public void XmlFormattingTests_TagNameKeepCase()
        {
            var input = "<Summary></Summary>";

            Settings.Default.Formatting_CommentXmlSplitSummaryTagToMultipleLines = false;
            Settings.Default.Formatting_CommentXmlTagsToLowerCase = false;

            CommentFormatHelper.AssertEqualAfterFormat(input);
        }
        public void XmlFormattingTests_AllRootLevelTagsOnNewLine()
        {
            var input    = "<tag1>abc</tag1><tag2>abc</tag2>";
            var expected =
                "<tag1>abc</tag1>" + Environment.NewLine +
                "<tag2>abc</tag2>";

            CommentFormatHelper.AssertEqualAfterFormat(input, expected);
        }
        public void SimpleFormatWithPrefixTests_NoTrailingWhitespaceOnEmptyLine()
        {
            var input =
                "// Lorem ipsum dolor sit amet." + Environment.NewLine +
                "//" + Environment.NewLine +
                "// Consectetur adipiscing elit.";

            CommentFormatHelper.AssertEqualAfterFormat(input, input, "//", o => o.WrapColumn = 40);
        }
Beispiel #13
0
        public void XmlFormattingTests_AllRootLevelTagsOnNewLine()
        {
            var input    = "<summary>abc</summary><returns>abc</returns>";
            var expected = "<summary>abc</summary>" + Environment.NewLine + "<returns>abc</returns>";

            Settings.Default.Formatting_CommentXmlSplitSummaryTagToMultipleLines = false;

            CommentFormatHelper.AssertEqualAfterFormat(input, expected);
        }
        public void SimpleFormatWithPrefixTests_KeepsPrefix()
        {
            var input    = "// Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
            var expected =
                "// Lorem ipsum dolor sit amet," + Environment.NewLine +
                "// consectetur adipiscing elit.";

            CommentFormatHelper.AssertEqualAfterFormat(input, expected, "//", o => o.WrapColumn = 40);
        }
        public void SimpleFormattingTests_DoesNotWrapShortLines()
        {
            var input = "Lorem ipsum dolor sit amet.";

            CommentFormatHelper.AssertEqualAfterFormat(input, new CodeCommentOptions()
            {
                WrapAtColumn = 100
            });
        }
Beispiel #16
0
        public void SimpleFormattingTests_RemoveBlankLinesBefore()
        {
            var input    = "\r\n\r\nLorem ipsum dolor sit amet.";
            var expected = "Lorem ipsum dolor sit amet.";

            CommentFormatHelper.AssertEqualAfterFormat(input, expected, new CodeCommentOptions(Settings.Default)
            {
                WrapAtColumn = 100,
            });
        }
        public void SimpleFormattingTests_WrapsLinesAsExpected()
        {
            var input    = "Lorem ipsum dolor sit.";
            var expected = "Lorem ipsum\r\ndolor sit.";

            CommentFormatHelper.AssertEqualAfterFormat(input, expected, new CodeCommentOptions()
            {
                WrapAtColumn = 12,
            });
        }
        public void XmlFormattingTests_AddSpaceToTagContent()
        {
            var input    = "<xml><c>test</c></xml>";
            var expected = "<xml> <c> test </c> </xml>";

            CommentFormatHelper.AssertEqualAfterFormat(input, expected, o =>
            {
                o.Xml.Default.SpaceContent = true;
            });
        }
        public void XmlFormattingTests_AddSpaceToInsideTags()
        {
            var input    = "<xml><see/></xml>";
            var expected = "<xml><see /></xml>";

            CommentFormatHelper.AssertEqualAfterFormat(input, expected, o =>
            {
                o.Xml.Default.SpaceSelfClosing = true;
            });
        }
        public void SimpleFormattingTests_RemovesLineBreaks()
        {
            var input    = "Lorem ipsum\r\ndolor sit amet.";
            var expected = "Lorem ipsum dolor sit amet.";

            CommentFormatHelper.AssertEqualAfterFormat(input, expected, new CodeCommentOptions()
            {
                WrapAtColumn = 100,
            });
        }
        public void SimpleFormattingTests_SkipWrapOnLastWord()
        {
            var input    = "Lorem ipsum dolor sit amet.";
            var expected = "Lorem ipsum\r\ndolor sit amet.";

            Settings.Default.Formatting_CommentWrapColumn         = 12;
            Settings.Default.Formatting_CommentSkipWrapOnLastWord = true;

            CommentFormatHelper.AssertEqualAfterFormat(input, expected);
        }
Beispiel #22
0
        public void XmlFormattingTests_AddSpaceToInsideTags()
        {
            var input    = "<summary><see/></summary>";
            var expected = "<summary><see /></summary>";

            Settings.Default.Formatting_CommentXmlSplitSummaryTagToMultipleLines = false;
            Settings.Default.Formatting_CommentXmlSpaceSingleTags = true;

            CommentFormatHelper.AssertEqualAfterFormat(input, expected);
        }
Beispiel #23
0
        public void XmlFormattingTests_BreakTagsWhenContainsParagraphs()
        {
            var input    = "<example><para>test</para></example>";
            var expected =
                "<example>" + Environment.NewLine +
                "<para>test</para>" + Environment.NewLine +
                "</example>";

            CommentFormatHelper.AssertEqualAfterFormat(input, expected);
        }
        public void SimpleFormatWithPrefixTests_TrimsLeadingLines()
        {
            var input =
                "//" + Environment.NewLine +
                "//" + Environment.NewLine +
                "// Comment with some leading lines";
            var expected =
                "// Comment with some leading lines";

            CommentFormatHelper.AssertEqualAfterFormat(input, expected, "//");
        }
        public void XmlFormattingTests_AddSpaceToTagContentWithSelfClosingTag()
        {
            var input    = "<tag1><tag2/></tag1>";
            var expected = "<tag1> <tag2/> </tag1>";

            CommentFormatHelper.AssertEqualAfterFormat(input, expected, o =>
            {
                o.Xml.Default.SpaceContent     = true;
                o.Xml.Default.SpaceSelfClosing = false;
            });
        }
        public void SimpleFormattingTests_SkipWrapOnLastWord()
        {
            var input    = "Lorem ipsum dolor sit amet.";
            var expected = "Lorem ipsum\r\ndolor sit amet.";

            CommentFormatHelper.AssertEqualAfterFormat(input, expected, new CodeCommentOptions()
            {
                WrapAtColumn       = 12,
                SkipWrapOnLastWord = true
            });
        }
        public void SimpleFormattingTests_WrapOnLastWord()
        {
            var input    = "Lorem ipsum dolor sit amet.";
            var expected = "Lorem ipsum\r\ndolor sit\r\namet.";

            CommentFormatHelper.AssertEqualAfterFormat(input, expected, o =>
            {
                o.WrapColumn         = 12;
                o.SkipWrapOnLastWord = false;
            });
        }
Beispiel #28
0
        public void XmlFormattingTests_DoesNotIndentCloseTag()
        {
            var input    = "<summary></summary><returns></returns>";
            var expected = "<summary>" + Environment.NewLine + "</summary>" + Environment.NewLine + "<returns></returns>";

            Settings.Default.Formatting_CommentXmlValueIndent = 4;
            Settings.Default.Formatting_CommentXmlSplitSummaryTagToMultipleLines = true;
            Settings.Default.Formatting_CommentXmlSplitAllTags = false;

            CommentFormatHelper.AssertEqualAfterFormat(input, expected);
        }
Beispiel #29
0
        public void HeaderFormattingTests_PreservesHyphenLinesWithoutXML()
        {
            var input =
                @"--------------------------------------------------------------------------------------------------------------------" + Environment.NewLine +
                Environment.NewLine +
                @"Copyright (c) 2012 - 2013 . All rights reserved." + Environment.NewLine +
                Environment.NewLine +
                @"--------------------------------------------------------------------------------------------------------------------";

            CommentFormatHelper.AssertEqualAfterFormat(input);
        }
        public void SimpleFormattingTests_MergesHyphenAndNonHyphenLines()
        {
            var input =
                @"-----" + Environment.NewLine +
                @"Second line to merge onto hyphen line";

            var expected =
                @"----- Second line to merge onto hyphen line";

            CommentFormatHelper.AssertEqualAfterFormat(input, expected);
        }