コード例 #1
0
        [Test] public void TestShortLines()
        {
            MailBodyParser parser = CreateParser("Short\nlines");

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

            AssertEquals(4, parser.ParagraphCount);
            VerifyPara(3, "Your text", ParagraphType.Plain);
        }
コード例 #3
0
        [Test] public void TestSig()
        {
            MailBodyParser parser = CreateParser("-- \nDmitry");

            Assert.AreEqual(2, parser.ParagraphCount);
            VerifyPara(0, "-- ", ParagraphType.Sig);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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));
        }
コード例 #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);
        }
コード例 #11
0
 private MailBodyParser CreateParser(string body)
 {
     _parser = new MailBodyParser(body, 10);
     return(_parser);
 }
コード例 #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);
        }
コード例 #13
0
 [Test] public void TestStripQuoting()
 {
     AssertEquals("Quoted text", MailBodyParser.StripQuoting("> Quoted text"));
     AssertEquals("", MailBodyParser.StripQuoting(">"));
     AssertEquals("Quoted text", MailBodyParser.StripQuoting("> > Quoted text"));
 }
コード例 #14
0
 [Test] public void TestGetQuotePrefix()
 {
     Assert.AreEqual("DJ", MailBodyParser.GetQuotePrefix("DJ> Quoted text"));
 }
コード例 #15
0
 [Test] public void TestGetQuoteLevel()
 {
     Assert.AreEqual(1, MailBodyParser.GetQuoteLevel("> Quoted text"));
 }
コード例 #16
0
        [Test] public void TestVariableLines()
        {
            MailBodyParser parser = CreateParser("Alpha beta gamma delta\nepsilon\nzeta theta iota kappa");

            Assert.AreEqual(3, parser.ParagraphCount);
        }
コード例 #17
0
        [Test] public void TestLongQuotePrefix()
        {
            MailBodyParser parser = CreateParser("----------------> ");

            Assert.AreEqual(0, parser.GetParagraph(0).QuoteLevel);
        }
コード例 #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);
        }