Skip to content

Commit

Permalink
Sanitize expected string.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Dec 18, 2023
1 parent c2a6624 commit de75609
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,35 @@ public void Should_format_to_html()
{
var expected = File.ReadAllText("Model/Contents/ComplexText.html");

Assert.Equal(expected.Trim(), node.ToHtml().Trim());
Assert.Equal(Sanitize(expected), Sanitize(node.ToHtml()));
}

[Fact]
public void Should_format_to_minimized_html()
{
var expected = File.ReadAllText("Model/Contents/ComplexText.min.html");

Assert.Equal(expected.Trim(), node.ToHtml(0).Trim());
Assert.Equal(Sanitize(expected), Sanitize(node.ToHtml(0)));
}

[Fact]
public void Should_format_to_markdown()
{
var expected = File.ReadAllText("Model/Contents/ComplexText.md");

Assert.Equal(expected.Trim(), node.ToMarkdown().Trim());
Assert.Equal(Sanitize(expected), Sanitize(node.ToMarkdown()));
}

[Fact]
public void Should_format_to_text()
{
var expected = File.ReadAllText("Model/Contents/ComplexText.txt");

Assert.Equal(expected.Trim(), node.ToText().Trim());
Assert.Equal(Sanitize(expected), Sanitize(node.ToText()));
}

private static string Sanitize(string source)
{
return source.Replace("\r\n", "\n").Trim();
}
}

0 comments on commit de75609

Please sign in to comment.