Exemple #1
0
        public void TestSwedishAndChineseCombination()
        {
            Account account = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            string swedishAndChinese = "ÅÄÖ汉语";
            string attachmentName    = swedishAndChinese + ".zip";

            string filename = Path.Combine(Path.GetTempPath(), attachmentName);

            File.WriteAllText(filename, swedishAndChinese);

            var message = new hMailServer.Message();

            message.AddRecipient("test", account.Address);
            message.From        = "Test";
            message.FromAddress = account.Address;
            message.Body        = swedishAndChinese;
            message.Attachments.Add(filename);
            message.Save();

            CustomAsserts.AssertFolderMessageCount(account.IMAPFolders[0], 1);

            hMailServer.Message downloadedMessage = account.IMAPFolders[0].Messages[0];
            Assert.AreNotEqual(0, downloadedMessage.Attachments.Count);
            Attachment attachment = downloadedMessage.Attachments[0];

            Assert.AreEqual(attachmentName, attachment.Filename);

            Assert.AreEqual(swedishAndChinese + Environment.NewLine, downloadedMessage.Body);
        }
Exemple #2
0
        public void TestJapaneseAttachments()
        {
            Account account = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            string attachmentName = "本本本.zip";

            string filename = Path.Combine(Path.GetTempPath(), attachmentName);

            File.WriteAllText(filename, "tjena moss");

            var message = new hMailServer.Message();

            message.AddRecipient("test", account.Address);
            message.From        = "Test";
            message.FromAddress = account.Address;
            message.Body        = "hejsan";
            message.Attachments.Add(filename);
            message.Save();

            CustomAsserts.AssertFolderMessageCount(account.IMAPFolders[0], 1);

            hMailServer.Message downloadedMessage = account.IMAPFolders[0].Messages[0];
            Assert.AreNotEqual(0, downloadedMessage.Attachments.Count);
            Attachment attachment = downloadedMessage.Attachments[0];

            Assert.AreEqual(attachmentName, attachment.Filename);
        }