public void TestMimeVisitor () { var dataDir = Path.Combine ("..", "..", "TestData", "mbox"); var visitor = new HtmlPreviewVisitor (); int index = 0; using (var stream = File.OpenRead (Path.Combine (dataDir, "jwz.mbox.txt"))) { var parser = new MimeParser (stream, MimeFormat.Mbox); while (!parser.IsEndOfStream) { var filename = string.Format ("jwz.body.{0}.html", index); var path = Path.Combine (dataDir, filename); var message = parser.ParseMessage (); string expected, actual; visitor.Visit (message); actual = visitor.HtmlBody; if (!string.IsNullOrEmpty (actual)) actual = actual.Replace ("\r\n", "\n"); if (!File.Exists (path) && actual != null) File.WriteAllText (path, actual); if (File.Exists (path)) expected = File.ReadAllText (path, Encoding.UTF8).Replace ("\r\n", "\n"); else expected = null; if (index != 6 && index != 13 && index != 31) { // message 6, 13 and 31 contain some japanese text that is broken in Mono Assert.AreEqual (expected, actual, "The bodies do not match for message {0}", index); } visitor.Reset (); index++; } } }