Exemplo n.º 1
0
        public void PureTextMsg_ReadTextTest()
        {
            string        path    = TestDataSample.GetEmailPath("raw text mail demo.msg");
            ParserContext context = new ParserContext(path);
            var           parser  = ParserFactory.CreateText(context);

            string result = parser.Parse();

            Assert.IsNotNullOrEmpty(result);
        }
Exemplo n.º 2
0
        public void HtmlMsg_ReadTextTest()
        {
            string        path    = TestDataSample.GetEmailPath("Azure pricing and services updates.msg");
            ParserContext context = new ParserContext(path);
            var           parser  = ParserFactory.CreateText(context);

            string result = parser.Parse();

            Assert.IsNotNullOrEmpty(result);
            Assert.IsTrue(result.IndexOf("[From] Azure Team<*****@*****.**>") >= 0);
            Assert.IsTrue(result.IndexOf("[To] [email protected]") > 0);
            Assert.IsTrue(result.IndexOf("[Subject] Azure pricing and services updates") > 0);
            Assert.IsFalse(result.IndexOf("[Cc]") > 0);
            Assert.IsFalse(result.IndexOf("[Bcc]") > 0);
        }
Exemplo n.º 3
0
        public void ReadEmlTest()
        {
            string        path    = TestDataSample.GetEmailPath("test.eml");
            ParserContext context = new ParserContext(path);
            IEmailParser  parser  = ParserFactory.CreateEmail(context);
            ToxyEmail     email   = parser.Parse();

            Assert.IsNotNullOrEmpty(email.From);
            Assert.AreEqual(1, email.To.Count);
            Assert.AreEqual("=?utf-8?B?5ouJ5Yu+572R?= <*****@*****.**>", email.From);
            Assert.AreEqual("*****@*****.**", email.To[0]);

            Assert.IsTrue(email.Subject.StartsWith("=?utf-8?B?5LiK5rW35YiG5LyX5b635bOw5bm/5ZGK?= =?utf-8?B?5Lyg5p"));
            Assert.IsTrue(email.TextBody.StartsWith("------=_Part_4546_1557510524.1418357602217\r\nContent-Type: text"));
            Assert.IsNull(email.HtmlBody);
        }
Exemplo n.º 4
0
        public void ReadEmlTest()
        {
            string        path    = TestDataSample.GetEmailPath("test.eml");
            ParserContext context = new ParserContext(path);
            IEmailParser  parser  = ParserFactory.CreateEmail(context);
            ToxyEmail     email   = parser.Parse();

            Assert.IsNotNull(email.From);
            Assert.IsNotEmpty(email.From);
            Assert.AreEqual(1, email.To.Count);
            Assert.AreEqual(email.From, "\u62C9\u52FE\u7F51 <*****@*****.**>");
            Assert.AreEqual(email.To[0], "*****@*****.**");

            Assert.AreEqual(email.Subject, "\u4E0A\u6D77\u5206\u4F17\u5FB7\u5CF0\u5E7F\u544A\u4F20\u64AD\u6709\u9650\u516C\u53F8-\u9AD8\u7EA7.NET\u8F6F\u4EF6\u5DE5\u7A0B\u5E08\u62DB\u8058\u53CD\u9988\u901A\u77E5");
            Assert.IsTrue(email.HtmlBody.StartsWith("<html>\r\n"));
            Assert.IsNull(email.TextBody);
        }
Exemplo n.º 5
0
        public void HtmlMsg_ReadMsgEntityTest()
        {
            string        path    = TestDataSample.GetEmailPath("Azure pricing and services updates.msg");
            ParserContext context = new ParserContext(path);
            var           parser  = ParserFactory.CreateEmail(context);

            var result = parser.Parse();

            Assert.AreEqual("Azure Team<*****@*****.**>", result.From);

            Assert.AreEqual(1, result.To.Count);
            Assert.AreEqual(0, result.Cc.Count);
            Assert.AreEqual(0, result.Bcc.Count);

            Assert.AreEqual("*****@*****.**", result.To[0]);
            Assert.AreEqual("Azure pricing and services updates", result.Subject);
            Assert.IsNotNull(result.TextBody);
            Assert.IsNotNull(result.HtmlBody);
        }