Skip to content

Commit

Permalink
Environment.NewLine causing test failures on Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardD2 committed Dec 22, 2023
1 parent 66d2571 commit da84555
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions RecordParser.Test/FileReaderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public void Read_csv_file_all_fields_quoted(string fileContent, bool hasHeader,
new () { id = new Guid("63858071-cbb3-5abd-9f88-3dfd565cc4ab"), name = "Lucy Berry", age = 49, birthday = DateTime.Parse("11/12/1961"), gender = Gender.Female, email = "vanvo@ro.pk", children = false },
new () { id = new Guid("203804f9-93e7-5510-8bb2-177296bafe6a"), name = "Frank Fox", age = 36, birthday = DateTime.Parse("3/19/1977"), gender = Gender.Male, email = "vav@ped.fj", children = true },
new () { id = new Guid("a8af66fb-bad4-51eb-810c-bf3ca22337c6"), name = "Isabel Todd", age = 51, birthday = DateTime.Parse("9/16/1999"), gender = Gender.Female, email = "gu@or.bz", children = false },
new () { id = new Guid("1a3d8a66-3e0c-50eb-99c1-a3926bce15ed"), name = $"Joseph {Environment.NewLine}Scott", age = 55, birthday = DateTime.Parse("10/26/1986"), gender = Gender.Male, email = "bup@vugeb.tt", children = false },
new () { id = new Guid("1a3d8a66-3e0c-50eb-99c1-a3926bce15ed"), name = "Joseph \r\nScott", age = 55, birthday = DateTime.Parse("10/26/1986"), gender = Gender.Male, email = "bup@vugeb.tt", children = false },
new () { id = new Guid("aa7d4395-f10f-5776-9912-e3d86c4b9d3c"), name = "Gilbert Brooks", age = 56, birthday = DateTime.Parse("3/1/1956"), gender = Gender.Female, email = "epiju@ba.ly", children = true },
new () { id = new Guid("1d25b811-4002-5744-ac40-93a50f2a442c"), name = "Louis \"Ronaldo\" Bennett", age = 25, birthday = DateTime.Parse("4/4/1967"), gender = Gender.Male, email = "ma@itrovive.tv", children = true },
new () { id = new Guid("8e963ae5-a9ed-5572-b11c-566abc6a8a56"), name = "Norman Parker", age = 57, birthday = DateTime.Parse("4/17/1969"), gender = Gender.Male, email = "omi@hewepa.bw", children = true },
Expand Down Expand Up @@ -291,7 +291,7 @@ public void Read_quoted_csv_file(string fileContent, bool hasHeader, bool parall
var expectedItems = new Quoted[]
{
new Quoted { Id = 1, Date = new DateTime(2010, 01, 02), Name = "Ana", Rate = "Good", Ranking = 56 },
new Quoted { Id = 2, Date = new DateTime(2011, 05, 12), Name = "Bob", Rate = $"Much {Environment.NewLine}Good", Ranking = 4 },
new Quoted { Id = 2, Date = new DateTime(2011, 05, 12), Name = "Bob", Rate = "Much \r\nGood", Ranking = 4 },
new Quoted { Id = 3, Date = new DateTime(2013, 12, 10), Name = "Carla", Rate = "\"Medium\"", Ranking = 5 },
new Quoted { Id = 4, Date = new DateTime(2015, 03, 03), Name = "Derik", Rate = "Absolute, Awesome", Ranking = 1 },
}
Expand Down Expand Up @@ -569,4 +569,4 @@ public void Read_plain_text_of_fixed_length_file(string fileContent, bool parall
result.Should().BeEquivalentTo(expected, cfg => cfg.WithStrictOrdering());
}
}
}
}
6 changes: 3 additions & 3 deletions RecordParser.Test/QuotedFileReaderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void Given_quoted_field_in_any_column_should_parse_successfully(bool para
a,1
", 3,b , "4"
a,b,c,d
""".Replace(Environment.NewLine, newline);
""".Replace("\r\n", newline);

var expected = new[]
{
Expand Down Expand Up @@ -119,7 +119,7 @@ public void Given_quoted_field_in_first_column_should_parse_successfully(bool pa
y",2,3,4
""";

var expected = ($"x{Environment.NewLine}y","2","3","4");
var expected = ("x\r\ny","2","3","4");
var reader = new StringReader(fileContent);
var options = new VariableLengthReaderRawOptions
{
Expand Down Expand Up @@ -375,4 +375,4 @@ public void Read_csv_file_with_quoted_quote(bool parallel)
items.Should().BeEquivalentTo(expectedItems, cfg => cfg.WithStrictOrdering());
}
}
}
}

0 comments on commit da84555

Please sign in to comment.