Skip to content

Commit

Permalink
Formatting unit test updates within the solution-settings branch base…
Browse files Browse the repository at this point in the history
…d on that feature now relying upon the common Settings architecture vs. a local CodeCommentOptions concept.
  • Loading branch information
codecadwallader committed Jun 27, 2015
1 parent 4703933 commit 92ef151
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
30 changes: 21 additions & 9 deletions CodeMaid.UnitTests/Formatting/ListFormattingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ namespace SteveCadwallader.CodeMaid.UnitTests.Formatting
[TestClass]
public class ListFormattingTests
{
[TestInitialize]
public void TestInitialize()
{
Settings.Default.Reset();
}

[TestMethod]
[TestCategory("Formatting UnitTests")]
public void ListFormattingTests_DashedList()
Expand All @@ -31,17 +37,19 @@ public void ListFormattingTests_DashedList()
@"Some text before." + Environment.NewLine +
@"- The first item with enough words to require wrapping." + Environment.NewLine +
@"- The second item with enough words to require wrapping." + Environment.NewLine +
@"Some trialing text.";
@"Some trailing text.";

var expected =
@"Some text before." + Environment.NewLine +
@"- The first item with enough" + Environment.NewLine +
@" words to require wrapping." + Environment.NewLine +
@"- The second item with enough" + Environment.NewLine +
@" words to require wrapping." + Environment.NewLine +
@"Some trialing text.";
@"Some trailing text.";

CommentFormatHelper.AssertEqualAfterFormat(input, expected, new CodeCommentOptions(Settings.Default) { WrapAtColumn = 30 });
Settings.Default.Formatting_CommentWrapColumn = 30;

CommentFormatHelper.AssertEqualAfterFormat(input, expected);
}

[TestMethod]
Expand All @@ -52,17 +60,19 @@ public void ListFormattingTests_NumberedList()
@"Some text before." + Environment.NewLine +
@"1) The first item with enough words to require wrapping." + Environment.NewLine +
@"2) The second item with enough words to require wrapping." + Environment.NewLine +
@"Some trialing text.";
@"Some trailing text.";

var expected =
@"Some text before." + Environment.NewLine +
@"1) The first item with enough" + Environment.NewLine +
@" words to require wrapping." + Environment.NewLine +
@"2) The second item with enough" + Environment.NewLine +
@" words to require wrapping." + Environment.NewLine +
@"Some trialing text.";
@"Some trailing text.";

CommentFormatHelper.AssertEqualAfterFormat(input, expected, new CodeCommentOptions(Settings.Default) { WrapAtColumn = 30 });
Settings.Default.Formatting_CommentWrapColumn = 30;

CommentFormatHelper.AssertEqualAfterFormat(input, expected);
}

[TestMethod]
Expand All @@ -73,17 +83,19 @@ public void ListFormattingTests_WordList()
@"Some text before." + Environment.NewLine +
@"item) The first item with enough words to require wrapping." + Environment.NewLine +
@"meti) The second item with enough words to require wrapping." + Environment.NewLine +
@"Some trialing text.";
@"Some trailing text.";

var expected =
@"Some text before." + Environment.NewLine +
@"item) The first item with enough" + Environment.NewLine +
@" words to require wrapping." + Environment.NewLine +
@"meti) The second item with enough" + Environment.NewLine +
@" words to require wrapping." + Environment.NewLine +
@"Some trialing text.";
@"Some trailing text.";

Settings.Default.Formatting_CommentWrapColumn = 35;

CommentFormatHelper.AssertEqualAfterFormat(input, expected, new CodeCommentOptions(Settings.Default) { WrapAtColumn = 35 });
CommentFormatHelper.AssertEqualAfterFormat(input, expected);
}
}
}
4 changes: 2 additions & 2 deletions CodeMaid.UnitTests/Formatting/SimpleFormattingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ public void SimpleFormattingTests_WrapOnLastWord()
public void SimpleFormattingTests_HyperlinkOnNewLine()
{
var input = "http://foo";
CommentFormatHelper.AssertEqualAfterFormat(input, new CodeCommentOptions(Settings.Default));
CommentFormatHelper.AssertEqualAfterFormat(input);
}

[TestMethod]
[TestCategory("Formatting UnitTests")]
public void SimpleFormattingTests_HyperlinkBetweenWords()
{
var input = "Look at this http://foo pretty link.";
CommentFormatHelper.AssertEqualAfterFormat(input, new CodeCommentOptions(Settings.Default));
CommentFormatHelper.AssertEqualAfterFormat(input);
}

[TestMethod]
Expand Down
4 changes: 2 additions & 2 deletions CodeMaid.UnitTests/Formatting/XmlFormattingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ public void XmlFormattingTests_DoNotAutoExpandTags()
public void XmlFormattingTests_HyperlinkOnNewLine()
{
var input = "<summary>" + Environment.NewLine + "http://foo" + Environment.NewLine + "</summary>";
CommentFormatHelper.AssertEqualAfterFormat(input, new CodeCommentOptions(Settings.Default));
CommentFormatHelper.AssertEqualAfterFormat(input);
}

[TestMethod]
[TestCategory("Formatting UnitTests")]
public void XmlFormattingTests_HyperlinkBetweenWords()
{
var input = "<summary>" + Environment.NewLine + "Look at this http://foo pretty link." + Environment.NewLine + "</summary>";
CommentFormatHelper.AssertEqualAfterFormat(input, new CodeCommentOptions(Settings.Default));
CommentFormatHelper.AssertEqualAfterFormat(input);
}

/// <summary>
Expand Down

0 comments on commit 92ef151

Please sign in to comment.