From 6101d00d659f539091869193bf948446f700f833 Mon Sep 17 00:00:00 2001 From: Justin Dearing Date: Mon, 3 Jun 2019 11:06:25 -0400 Subject: [PATCH] Fix some unit tests. --- FlatFiles.Test/DataTableExtensionsTester.cs | 14 ++++++++++++-- FlatFiles.Test/DateTimeColumnTester.cs | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/FlatFiles.Test/DataTableExtensionsTester.cs b/FlatFiles.Test/DataTableExtensionsTester.cs index c45502a..de940c2 100644 --- a/FlatFiles.Test/DataTableExtensionsTester.cs +++ b/FlatFiles.Test/DataTableExtensionsTester.cs @@ -322,7 +322,12 @@ public void TestWriteFlatFile_MatchingSchema() DataRow susanRow = table.Rows.Add(new object[] { 3, "Susan", new DateTime(2018, 07, 18), 34.56m }); DataRow nullRow = table.Rows.Add(new object[] { 4, null, null, null }); - var options = new SeparatedValueOptions() { IsFirstRecordSchema = true }; + var options = new SeparatedValueOptions() + { + IsFirstRecordSchema = true, + RecordSeparator = "\r\n", + FormatProvider = CultureInfo.InvariantCulture + }; var stringWriter = new StringWriter(); var schema = new SeparatedValueSchema(); schema.AddColumn(new Int32Column("id")); @@ -421,7 +426,12 @@ public void TestWriteFlatFile_IgnoredColumns() DataRow johnRow = table.Rows.Add(new object[] { 2, "John", new DateTime(2018, 07, 17), 23.45m }); DataRow susanRow = table.Rows.Add(new object[] { 3, "Susan", new DateTime(2018, 07, 18), 34.56m }); - var options = new SeparatedValueOptions() { IsFirstRecordSchema = true }; + var options = new SeparatedValueOptions() + { + IsFirstRecordSchema = true, + RecordSeparator = "\r\n", + FormatProvider = CultureInfo.InvariantCulture + }; var stringWriter = new StringWriter(); var schema = new SeparatedValueSchema(); schema.AddColumn(new IgnoredColumn("i0")); diff --git a/FlatFiles.Test/DateTimeColumnTester.cs b/FlatFiles.Test/DateTimeColumnTester.cs index 90f21ae..e2e72b8 100644 --- a/FlatFiles.Test/DateTimeColumnTester.cs +++ b/FlatFiles.Test/DateTimeColumnTester.cs @@ -87,7 +87,7 @@ public void TestParse_FormatProvider_FormatString_ParsesExactly() DateTimeColumn column = new DateTimeColumn("created") { InputFormat = "d", - FormatProvider = CultureInfo.CurrentCulture + FormatProvider = CultureInfo.InvariantCulture }; DateTime actual = (DateTime)column.Parse(null, "1/19/2013"); DateTime expected = new DateTime(2013, 1, 19);