Ejemplo n.º 1
0
        [Test] public void TestShortLines()
        {
            MailBodyParser parser = CreateParser("Short\nlines");

            Assert.AreEqual(2, parser.ParagraphCount);
            VerifyPara(0, "Short", ParagraphType.Fixed);
        }
Ejemplo n.º 2
0
        [Test] public void TestAfterSig()
        {
            MailBodyParser parser = CreateParser("-- \nDmitry\n\nYour text");

            AssertEquals(4, parser.ParagraphCount);
            VerifyPara(3, "Your text", ParagraphType.Plain);
        }
Ejemplo n.º 3
0
        [Test] public void TestSig()
        {
            MailBodyParser parser = CreateParser("-- \nDmitry");

            Assert.AreEqual(2, parser.ParagraphCount);
            VerifyPara(0, "-- ", ParagraphType.Sig);
        }
Ejemplo n.º 4
0
        [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);
        }
Ejemplo n.º 5
0
        [Test] public void TestQuotePrefix()
        {
            MailBodyParser parser = CreateParser("DJ> Quoted text");

            VerifyPara(0, "Quoted text", ParagraphType.Plain);
            Assert.AreEqual("DJ", parser.GetParagraph(0).QuotePrefix);
        }
Ejemplo n.º 6
0
        [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);
        }
Ejemplo n.º 7
0
        [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);
        }
Ejemplo n.º 8
0
        [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);
        }
Ejemplo n.º 9
0
        [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));
        }
Ejemplo n.º 10
0
        [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);
        }
Ejemplo n.º 11
0
 private MailBodyParser CreateParser(string body)
 {
     _parser = new MailBodyParser(body, 10);
     return(_parser);
 }
Ejemplo n.º 12
0
        [Test] public void TestFormatFlowed()
        {
            MailBodyParser parser = CreateParser("This is a test \r\nmessage");

            AssertEquals("This is a test message", parser.GetParagraph(0).Text);
        }
Ejemplo n.º 13
0
 [Test] public void TestStripQuoting()
 {
     AssertEquals("Quoted text", MailBodyParser.StripQuoting("> Quoted text"));
     AssertEquals("", MailBodyParser.StripQuoting(">"));
     AssertEquals("Quoted text", MailBodyParser.StripQuoting("> > Quoted text"));
 }
Ejemplo n.º 14
0
 [Test] public void TestGetQuotePrefix()
 {
     Assert.AreEqual("DJ", MailBodyParser.GetQuotePrefix("DJ> Quoted text"));
 }
Ejemplo n.º 15
0
 [Test] public void TestGetQuoteLevel()
 {
     Assert.AreEqual(1, MailBodyParser.GetQuoteLevel("> Quoted text"));
 }
Ejemplo n.º 16
0
        [Test] public void TestVariableLines()
        {
            MailBodyParser parser = CreateParser("Alpha beta gamma delta\nepsilon\nzeta theta iota kappa");

            Assert.AreEqual(3, parser.ParagraphCount);
        }
Ejemplo n.º 17
0
        [Test] public void TestLongQuotePrefix()
        {
            MailBodyParser parser = CreateParser("----------------> ");

            Assert.AreEqual(0, parser.GetParagraph(0).QuoteLevel);
        }
Ejemplo n.º 18
0
        [Test] public void TestShortLastLine()
        {
            MailBodyParser parser = new MailBodyParser("Alpha beta gamma delta\nepsilon zeta theta iota\nkappa", 20);

            Assert.AreEqual(1, parser.ParagraphCount);
        }