Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing hard coded line endings.

  • Loading branch information...
commit ab2f0b8fa94a0c75ad3e1d0f30a35bcbb6f71b20 1 parent 392ce94
@dragan dragan authored
View
14 tests/ServiceStack.Text.Tests/CsvStreamTests.cs
@@ -29,7 +29,14 @@ public void Can_create_csv_from_Categories()
var categories = new[] { category, category };
var csv = CsvSerializer.SerializeToCsv(categories);
Log(csv);
- Assert.That(csv, Is.EqualTo("Id,CategoryName,Description,Picture\r\n1,\"between \"\"quotes\"\" here\",\"with, comma\",\r\n1,\"between \"\"quotes\"\" here\",\"with, comma\",\r\n"));
+ Assert.That(csv, Is.EqualTo(
+ "Id,CategoryName,Description,Picture"
+ + Environment.NewLine
+ + "1,\"between \"\"quotes\"\" here\",\"with, comma\","
+ + Environment.NewLine
+ + "1,\"between \"\"quotes\"\" here\",\"with, comma\","
+ + Environment.NewLine
+ ));
}
[Test]
@@ -38,7 +45,10 @@ public void Can_generate_csv_with_invalid_chars()
var fields = new[] { "1", "2", "3\"", "4", "5\"five,six\"", "7,7.1", "\"7,7.1\"", "8" };
var csv = CsvSerializer.SerializeToCsv(fields);
Log(csv);
- Assert.That(csv, Is.EqualTo("1,2,\"3\"\"\",4,\"5\"\"five,six\"\"\",\"7,7.1\",\"\"\"7,7.1\"\"\",8\r\n"));
+ Assert.That(csv, Is.EqualTo(
+ "1,2,\"3\"\"\",4,\"5\"\"five,six\"\"\",\"7,7.1\",\"\"\"7,7.1\"\"\",8"
+ + Environment.NewLine
+ ));
}
[Test]
View
33 tests/ServiceStack.Text.Tests/CsvTests/CustomHeaderTests.cs
@@ -34,9 +34,12 @@ public void Can_serialize_custom_headers_map()
Console.WriteLine(csv);
Assert.That(csv, Is.EqualTo(
- "Column 1,Column 2,\"Column,3\",\"Column\n4\",Column 5\r\n"
- + "I,Like,To,Read,Novels\r\n"
- + "I am,Very,Cool,And,Awesome\r\n"
+ "Column 1,Column 2,\"Column,3\",\"Column\n4\",Column 5"
+ + Environment.NewLine
+ + "I,Like,To,Read,Novels"
+ + Environment.NewLine
+ + "I am,Very,Cool,And,Awesome"
+ + Environment.NewLine
));
}
@@ -60,9 +63,12 @@ public void Can_serialize_custom_anonymous_type_headers()
Console.WriteLine(csv);
Assert.That(csv, Is.EqualTo(
- "Column 1,Column 2,\"Column,3\",\"Column\n4\",Column 5\r\n"
- + "I,Like,To,Read,Novels\r\n"
- + "I am,Very,Cool,And,Awesome\r\n"
+ "Column 1,Column 2,\"Column,3\",\"Column\n4\",Column 5"
+ + Environment.NewLine
+ + "I,Like,To,Read,Novels"
+ + Environment.NewLine
+ + "I am,Very,Cool,And,Awesome"
+ + Environment.NewLine
));
}
@@ -84,9 +90,12 @@ public void Can_serialize_partial_custom_headers_map()
Console.WriteLine(csv);
Assert.That(csv, Is.EqualTo(
- "Column 1,\"Column,3\",Column 5\r\n"
- + "I,To,Novels\r\n"
- + "I am,Cool,Awesome\r\n"
+ "Column 1,\"Column,3\",Column 5"
+ + Environment.NewLine
+ + "I,To,Novels"
+ + Environment.NewLine
+ + "I am,Cool,Awesome"
+ + Environment.NewLine
));
}
@@ -112,8 +121,10 @@ public void Can_serialize_without_headers()
Console.WriteLine(csv);
Assert.That(csv, Is.EqualTo(
- "I,Like,To,Read,Novels\r\n"
- + "I am,Very,Cool,And,Awesome\r\n"
+ "I,Like,To,Read,Novels"
+ + Environment.NewLine
+ + "I am,Very,Cool,And,Awesome"
+ + Environment.NewLine
));
}
View
22 tests/ServiceStack.Text.Tests/CsvTests/NewLineTests.cs
@@ -24,13 +24,21 @@ public void Serializes_adhoc_data()
Console.WriteLine(csv);
Assert.That(csv, Is.EqualTo(
- "Column1Data,Column2Data,Column3Data,Column4Data,Column5Data\r\n"
- + "I,Like,To,Read,Novels\r\n"
- + "I am,Very,Cool,And,Awesome\r\n"
- + "I, Like ,Reading,,\r\n"
- + "I,Don't,\"Know,\",Do,You?\r\n"
- + "I,Saw,The,Movie,\"\"\"Jaws\"\"\"\r\n"
- + "I,Went,To,\"Space\nCamp\",\"Last\r\nYear\"\r\n"));
+ "Column1Data,Column2Data,Column3Data,Column4Data,Column5Data"
+ + Environment.NewLine
+ + "I,Like,To,Read,Novels"
+ + Environment.NewLine
+ + "I am,Very,Cool,And,Awesome"
+ + Environment.NewLine
+ + "I, Like ,Reading,,"
+ + Environment.NewLine
+ + "I,Don't,\"Know,\",Do,You?"
+ + Environment.NewLine
+ + "I,Saw,The,Movie,\"\"\"Jaws\"\"\""
+ + Environment.NewLine
+ + "I,Went,To,\"Space\nCamp\",\"Last\r\nYear\""
+ + Environment.NewLine
+ ));
}
}
View
31 tests/ServiceStack.Text.Tests/GenericCollectionTests.cs
@@ -1,3 +1,4 @@
+using System;
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
@@ -21,7 +22,7 @@ public void Can_serialize_Queue_string()
Serialize(queue);
- Assert.That(CsvSerializer.SerializeToString(queue), Is.EqualTo("one,two,three\r\n"));
+ Assert.That(CsvSerializer.SerializeToString(queue), Is.EqualTo("one,two,three" + Environment.NewLine));
}
[Test]
@@ -35,7 +36,7 @@ public void Can_serialize_Queue_int()
Serialize(queue);
- Assert.That(CsvSerializer.SerializeToString(queue), Is.EqualTo("1,2,3\r\n"));
+ Assert.That(CsvSerializer.SerializeToString(queue), Is.EqualTo("1,2,3" + Environment.NewLine));
}
[Test]
@@ -50,7 +51,16 @@ public void Can_serialize_Queue_Generic()
Serialize(queue);
Assert.That(CsvSerializer.SerializeToString(queue),
- Is.EqualTo("Id,Name\r\n1,Name1\r\n2,Name2\r\n3,Name3\r\n"));
+ Is.EqualTo(
+ "Id,Name"
+ + Environment.NewLine
+ + "1,Name1"
+ + Environment.NewLine
+ + "2,Name2"
+ + Environment.NewLine
+ + "3,Name3"
+ + Environment.NewLine
+ ));
}
[Test]
@@ -64,7 +74,7 @@ public void Can_serialize_Stack_string()
Serialize(stack);
- Assert.That(CsvSerializer.SerializeToString(stack), Is.EqualTo("three,two,one\r\n"));
+ Assert.That(CsvSerializer.SerializeToString(stack), Is.EqualTo("three,two,one" + Environment.NewLine));
}
[Test]
@@ -78,7 +88,7 @@ public void Can_serialize_Stack_int()
Serialize(stack);
- Assert.That(CsvSerializer.SerializeToString(stack), Is.EqualTo("3,2,1\r\n"));
+ Assert.That(CsvSerializer.SerializeToString(stack), Is.EqualTo("3,2,1" + Environment.NewLine));
}
[Test]
@@ -93,7 +103,16 @@ public void Can_serialize_Stack_Generic()
Serialize(stack);
Assert.That(CsvSerializer.SerializeToString(stack),
- Is.EqualTo("Id,Name\r\n3,Name3\r\n2,Name2\r\n1,Name1\r\n"));
+ Is.EqualTo(
+ "Id,Name"
+ + Environment.NewLine
+ + "3,Name3"
+ + Environment.NewLine
+ + "2,Name2"
+ + Environment.NewLine
+ + "1,Name1"
+ + Environment.NewLine
+ ));
}
}
View
22 tests/ServiceStack.Text.Tests/Utils/JsvFormatterTests.cs
@@ -14,7 +14,16 @@ public void Can_PrettyFormat_generic_type()
var model = new ModelWithIdAndName { Id = 1, Name = "Name" };
var modelStr = model.Dump();
- Assert.That(modelStr, Is.EqualTo("{\r\n\tId: 1,\r\n\tName: Name\r\n}"));
+ Assert.That(modelStr,
+ Is.EqualTo(
+ "{"
+ + Environment.NewLine
+ + "\tId: 1,"
+ + Environment.NewLine
+ + "\tName: Name"
+ + Environment.NewLine
+ + "}"
+ ));
}
[Test]
@@ -25,7 +34,16 @@ public void Can_PrettyFormat_object()
Console.WriteLine(modelStr);
- Assert.That(modelStr, Is.EqualTo("{\r\n\tId: 1,\r\n\tName: Name\r\n}"));
+ Assert.That(modelStr,
+ Is.EqualTo(
+ "{"
+ + Environment.NewLine
+ + "\tId: 1,"
+ + Environment.NewLine
+ +"\tName: Name"
+ + Environment.NewLine
+ + "}"
+ ));
}
internal class TestModel
Please sign in to comment.
Something went wrong with that request. Please try again.