[Test] public void TestShortLines() { MailBodyParser parser = CreateParser("Short\nlines"); Assert.AreEqual(2, parser.ParagraphCount); VerifyPara(0, "Short", ParagraphType.Fixed); }
[Test] public void TestAfterSig() { MailBodyParser parser = CreateParser("-- \nDmitry\n\nYour text"); AssertEquals(4, parser.ParagraphCount); VerifyPara(3, "Your text", ParagraphType.Plain); }
[Test] public void TestSig() { MailBodyParser parser = CreateParser("-- \nDmitry"); Assert.AreEqual(2, parser.ParagraphCount); VerifyPara(0, "-- ", ParagraphType.Sig); }
[Test] public void TestMultilineQuoting() { MailBodyParser parser = CreateParser("> Quoted quoted quoted\n> text"); Assert.AreEqual(1, parser.ParagraphCount); VerifyPara(0, "Quoted quoted quoted text", ParagraphType.Plain); }
[Test] public void TestQuotePrefix() { MailBodyParser parser = CreateParser("DJ> Quoted text"); VerifyPara(0, "Quoted text", ParagraphType.Plain); Assert.AreEqual("DJ", parser.GetParagraph(0).QuotePrefix); }
[Test] public void TestFirstLineIndent() { MailBodyParser parser = CreateParser(" This is a\ntest message"); Assert.AreEqual(1, parser.ParagraphCount); VerifyPara(0, " This is a test message", ParagraphType.Plain); }
[Test] public void TestFixedParaVariable() { MailBodyParser parser = CreateParser(" This is a test\n message"); Assert.AreEqual(2, parser.ParagraphCount); VerifyPara(0, " This is a test", ParagraphType.Fixed); VerifyPara(1, " message", ParagraphType.Fixed); }
[Test] public void TestWhitespaceLines() { MailBodyParser parser = CreateParser("This is a test\n \t\nmessage"); Assert.AreEqual(2, parser.ParagraphCount); Assert.AreEqual("This is a test", parser.GetParagraph(0).Text); Assert.AreEqual("message", parser.GetParagraph(1).Text); }
[Test] public void SeveralWordsBeforeQuoting() { string test = "Test Test Test > Test Test"; AssertEquals(test, MailBodyParser.StripQuoting(test)); AssertEquals("", MailBodyParser.GetQuotePrefix(test)); AssertEquals(0, MailBodyParser.GetQuoteLevel(test)); }
[Test] public void BasicTest() { MailBodyParser parser = CreateParser("This is a test message"); Assert.AreEqual(1, parser.ParagraphCount); MailBodyParser.Paragraph para = parser.GetParagraph(0); Assert.IsNotNull(para); Assert.AreEqual("This is a test message", para.Text); Assert.AreEqual(ParagraphType.Plain, para.Type); }
private MailBodyParser CreateParser(string body) { _parser = new MailBodyParser(body, 10); return(_parser); }
[Test] public void TestFormatFlowed() { MailBodyParser parser = CreateParser("This is a test \r\nmessage"); AssertEquals("This is a test message", parser.GetParagraph(0).Text); }
[Test] public void TestStripQuoting() { AssertEquals("Quoted text", MailBodyParser.StripQuoting("> Quoted text")); AssertEquals("", MailBodyParser.StripQuoting(">")); AssertEquals("Quoted text", MailBodyParser.StripQuoting("> > Quoted text")); }
[Test] public void TestGetQuotePrefix() { Assert.AreEqual("DJ", MailBodyParser.GetQuotePrefix("DJ> Quoted text")); }
[Test] public void TestGetQuoteLevel() { Assert.AreEqual(1, MailBodyParser.GetQuoteLevel("> Quoted text")); }
[Test] public void TestVariableLines() { MailBodyParser parser = CreateParser("Alpha beta gamma delta\nepsilon\nzeta theta iota kappa"); Assert.AreEqual(3, parser.ParagraphCount); }
[Test] public void TestLongQuotePrefix() { MailBodyParser parser = CreateParser("----------------> "); Assert.AreEqual(0, parser.GetParagraph(0).QuoteLevel); }
[Test] public void TestShortLastLine() { MailBodyParser parser = new MailBodyParser("Alpha beta gamma delta\nepsilon zeta theta iota\nkappa", 20); Assert.AreEqual(1, parser.ParagraphCount); }