Skip to content

Commit

Permalink
Merge pull request #56 from zippy1981/bug/date-time-formatting
Browse files Browse the repository at this point in the history
Fix some unit tests.
  • Loading branch information
jehugaleahsa authored Jun 3, 2019
2 parents fd195c7 + 6101d00 commit b925f6d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions FlatFiles.Test/DataTableExtensionsTester.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down Expand Up @@ -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"));
Expand Down
2 changes: 1 addition & 1 deletion FlatFiles.Test/DateTimeColumnTester.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b925f6d

Please sign in to comment.