Permalink
Browse files

Test updates to ignore \r\n vs. \n.

  • Loading branch information...
1 parent 753ab2f commit 90a817b783e116d4072054a82ee6627631ef4783 @MikeStall committed Jun 9, 2012
@@ -41,11 +41,20 @@ MutableDataTable GetInMemoryTable()
return dt;
}
+ // Do string comparison, ignoring ignoring newline (\r\n vs just \n)
+ public static void AssertEquals(string content, string actual)
+ {
+ content = content.Replace("\r\n", "\n");
+ actual = actual.Replace("\r\n", "\n");
+ Assert.Equal(content, actual);
+ }
+
public static void AssertEquals(string content, DataTable dt)
{
StringWriter sw = new StringWriter();
dt.SaveToStream(sw);
- Assert.Equal(content, sw.ToString());
+ string actual = sw.ToString();
+ AssertEquals(content, actual);
}
[Fact]
@@ -153,16 +162,16 @@ public void ShredTest()
File.Delete(file1);
File.Delete(file2);
- Assert.Equal(
+ AnalyzeTests.AssertEquals(
@"first,last,age
Bob,Smith,12
Ed,Smith,12
John,Smith,34
", content1);
-
- Assert.Equal(
+
+ AnalyzeTests.AssertEquals(
@"first,last,age
Bob,Jones,34
", content2);
@@ -19,7 +19,7 @@ public void SaveToCSV()
dt.SaveCSV(temp);
string content = File.ReadAllText(temp);
- Assert.Equal(
+ AnalyzeTests.AssertEquals(
@"value
10
20
@@ -125,7 +125,7 @@ public void ArrayToTable()
StringWriter sw = new StringWriter();
dt.SaveToStream(sw);
- Assert.Equal(
+ AnalyzeTests.AssertEquals(
@"x,y
11,12
21,22

0 comments on commit 90a817b

Please sign in to comment.