Skip to content

Commit

Permalink
Fix test line ending issues
Browse files Browse the repository at this point in the history
  • Loading branch information
devlead committed May 9, 2018
1 parent 726c05d commit aee3e16
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 28 deletions.
30 changes: 18 additions & 12 deletions test/JsonMapperTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,15 @@ public void ExportPrettyPrint ()
sample["flaming"] = "pie";
sample["nine"] = 9;

string expected = @"
{
""rolling"" : ""stones"",
""flaming"" : ""pie"",
""nine"" : 9
}";
string expected =string.Join(
Environment.NewLine,
new [] {
"",
"{",
" \"rolling\" : \"stones\",",
" \"flaming\" : \"pie\",",
" \"nine\" : 9",
"}"});

JsonWriter writer = new JsonWriter ();
writer.PrettyPrint = true;
Expand All @@ -368,12 +371,15 @@ public void ExportPrettyPrint ()
writer.Reset ();
writer.IndentValue = 8;

expected = @"
{
""rolling"" : ""stones"",
""flaming"" : ""pie"",
""nine"" : 9
}";
expected = string.Join(
Environment.NewLine,
new [] {
"",
"{",
" \"rolling\" : \"stones\",",
" \"flaming\" : \"pie\",",
" \"nine\" : 9",
"}"});
JsonMapper.ToJson (sample, writer);

Assert.AreEqual (expected, writer.ToString (), "A2");
Expand Down
35 changes: 19 additions & 16 deletions test/JsonWriterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,21 +232,24 @@ public void PrettyPrintTest ()
{
JsonWriter writer = new JsonWriter ();

string json = @"
[
{
""precision"" : ""zip"",
""Latitude"" : 37.7668,
""Longitude"" : -122.3959,
""City"" : ""SAN FRANCISCO""
},
{
""precision"" : ""zip"",
""Latitude"" : 37.371991,
""Longitude"" : -122.02602,
""City"" : ""SUNNYVALE""
}
]";
string json = string.Join(
Environment.NewLine,
new [] {
"",
"[",
" {",
" \"precision\" : \"zip\",",
" \"Latitude\" : 37.7668,",
" \"Longitude\" : -122.3959,",
" \"City\" : \"SAN FRANCISCO\"",
" },",
" {",
" \"precision\" : \"zip\",",
" \"Latitude\" : 37.371991,",
" \"Longitude\" : -122.02602,",
" \"City\" : \"SUNNYVALE\"",
" }",
"]"});

writer.PrettyPrint = true;

Expand Down Expand Up @@ -276,7 +279,7 @@ public void PrettyPrintTest ()
writer.WriteObjectEnd ();
writer.WriteArrayEnd ();

Assert.AreEqual (writer.ToString (), json);
Assert.AreEqual (json, writer.ToString ());
}

[Test]
Expand Down

0 comments on commit aee3e16

Please sign in to comment.