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);
        }
Beispiel #2
0
        public void ReadCnmTest()
        {
            string        path    = TestDataSample.GetCNMPath("Y0B6E8H2.CNM");
            ParserContext context = new ParserContext(path);
            IEmailParser  parser  = ParserFactory.CreateEmail(context) as IEmailParser;
            ToxyEmail     email   = parser.Parse();

            Assert.AreEqual(1, email.From.Count);
            Assert.AreEqual(1, email.To.Count);
            Assert.AreEqual("Тюльпаны <*****@*****.**>", email.From[0]);
            Assert.AreEqual("<*****@*****.**>", email.To[0]);

            Assert.AreEqual("Тюльпаны", email.Subject);
            Assert.IsTrue(email.Body.StartsWith("Тел: 960-51-57;Продажа тюльпанов"));
            Assert.IsTrue(email.HtmlBody.StartsWith("<!DOCTYPE HTML"));
        }
Beispiel #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.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);
        }
Beispiel #4
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);
        }