Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/09/10 11:14:37 (12 years ago)
Author:
epitzer
Message:

Replace XML reader to ensure proper parsing of line endings especially inside CDATA blocks (#548)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Tests/UseCases.cs

    r3057 r3293  
    10071007    }
    10081008
     1009    [TestMethod]
     1010    public void TestLineEndings() {
     1011      List<string> lineBreaks = new List<string> { "\r\n", "\n", "\r", "\n\r", Environment.NewLine };
     1012      List<string> lines = new List<string>();
     1013      foreach (var br in lineBreaks)
     1014        lines.Add("line1" + br + "line2");
     1015      XmlGenerator.Serialize(lines, tempFile);
     1016      List<string> newLines = XmlParser.Deserialize<List<string>>(tempFile);
     1017      Assert.AreEqual(lines.Count, newLines.Count);
     1018      for (int i = 0; i < lineBreaks.Count; i++) {
     1019        Assert.AreEqual(lines[i], newLines[i]);
     1020      }
     1021    }
    10091022   
    10101023
Note: See TracChangeset for help on using the changeset viewer.