当前位置: 首页>>代码示例>>C#>>正文


C# IMAPSimulator.ConnectAndLogon方法代码示例

本文整理汇总了C#中IMAPSimulator.ConnectAndLogon方法的典型用法代码示例。如果您正苦于以下问题:C# IMAPSimulator.ConnectAndLogon方法的具体用法?C# IMAPSimulator.ConnectAndLogon怎么用?C# IMAPSimulator.ConnectAndLogon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IMAPSimulator的用法示例。


在下文中一共展示了IMAPSimulator.ConnectAndLogon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestRetrievalOfMessageInDeletedFolderUsingIMAP

        public void TestRetrievalOfMessageInDeletedFolderUsingIMAP()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();
             string deletedMessageText = _settings.ServerMessages.get_ItemByName("MESSAGE_FILE_MISSING").Text;

             hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

             SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "SampleBody");

             hMailServer.IMAPFolder inbox = account.IMAPFolders.get_ItemByName("Inbox"); ;

             Utilities.AssertMessageExistsInFolder(inbox, 1);

             hMailServer.Message message = inbox.Messages[0];

             DirectoryInfo dir = new DirectoryInfo(Path.GetFullPath(message.Filename));
             DirectoryInfo parent = dir.Parent.Parent.Parent;
             parent.Delete(true);

             IMAPSimulator sim = new IMAPSimulator();
             sim.ConnectAndLogon(account.Address, "test");
             sim.SelectFolder("INBOX");
             string result = sim.Fetch("1 BODY[1]");

             Assert.IsTrue(result.Contains(deletedMessageText.Replace("%MACRO_FILE%", message.Filename)));
             Utilities.AssertReportedError();
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:27,代码来源:StabilitySanityTests.cs

示例2: TestSearchInvalidCharset

        public void TestSearchInvalidCharset()
        {
            hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

             SMTPClientSimulator.StaticSend(account.Address, account.Address, "MySubject", "MyBody");

             POP3Simulator.AssertMessageCount(account.Address, "test", 1);

             IMAPSimulator oSimulator = new IMAPSimulator();
             Assert.IsTrue(oSimulator.ConnectAndLogon(account.Address, "test"));
             Assert.IsTrue(oSimulator.SelectFolder("INBOX"));

             string result = oSimulator.SendSingleCommand("A01 SEARCH CHARSET NONEXISTANT ALL SUBJECT MySubject");
             Assert.AreEqual("A01 NO [BADCHARSET]\r\n", result);
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:15,代码来源:IMAP.Search.cs

示例3: TestRenameSubFolderToMatchingName

        public void TestRenameSubFolderToMatchingName()
        {
            hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

              IMAPSimulator oSimulator = new IMAPSimulator();
              Assert.IsTrue(oSimulator.ConnectAndLogon(account.Address, "test"));
              Assert.IsTrue(oSimulator.CreateFolder("Folder1"));
              Assert.IsTrue(oSimulator.SelectFolder("Folder1"));

              string result = string.Empty;
              Assert.IsFalse(oSimulator.RenameFolder("Folder1", "Folder1.Sub1", out result));
              Assert.IsTrue(result.Contains("A folder cannot be moved into one of its subfolders."));
              Assert.IsTrue(oSimulator.SelectFolder("Folder1"));

              result = string.Empty;
              Assert.IsTrue(oSimulator.RenameFolder("Folder1", "Folder1Test", out result));
              Assert.IsTrue(oSimulator.SelectFolder("Folder1Test"));

              oSimulator.Disconnect();
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:20,代码来源:IMAP.Folders.cs

示例4: TestPublicFolderUpdateNotification

        public void TestPublicFolderUpdateNotification()
        {
            hMailServer.IMAPFolders folders = _application.Settings.PublicFolders;
             hMailServer.IMAPFolder folder = folders.Add("Share");
             folder.Save();

             hMailServer.IMAPFolderPermission permission = folder.Permissions.Add();
             permission.PermissionType = hMailServer.eACLPermissionType.ePermissionTypeAnyone;
             permission.set_Permission(hMailServer.eACLPermission.ePermissionLookup, true);
             permission.set_Permission(hMailServer.eACLPermission.ePermissionRead, true);
             permission.set_Permission(hMailServer.eACLPermission.ePermissionWriteOthers, true);
             permission.set_Permission(hMailServer.eACLPermission.ePermissionWriteSeen, true);
             permission.set_Permission(hMailServer.eACLPermission.ePermissionWriteDeleted, true);
             permission.set_Permission(hMailServer.eACLPermission.ePermissionInsert, true);
             permission.Save();

             hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

             SMTPClientSimulator.StaticSend(account.Address, account.Address, "TestSubject", "TestBody");
             IMAPSimulator.AssertMessageCount(account.Address, "test", "Inbox", 1);

             IMAPSimulator simulator1 = new IMAPSimulator();
             IMAPSimulator simulator2 = new IMAPSimulator();

             simulator1.ConnectAndLogon(account.Address, "test");
             simulator2.ConnectAndLogon(account.Address, "test");

             simulator1.SelectFolder("Inbox");
             simulator2.SelectFolder("Inbox");

             Assert.IsTrue(simulator1.Copy(1, "#Public.Share"));

             simulator1.SelectFolder("#Public.Share");
             simulator2.SelectFolder("#Public.Share");

             string result = simulator2.NOOP() + simulator2.NOOP();
             Assert.IsFalse(result.Contains("Deleted"));
             Assert.IsFalse(result.Contains("Seen"));

             simulator1.SetDeletedFlag(1);
             simulator1.SetSeenFlag(1);

             result = simulator2.NOOP() + simulator2.NOOP();
             Assert.IsTrue(result.Contains("Deleted"));
             Assert.IsTrue(result.Contains("Seen"));

             simulator1.Disconnect();
             simulator2.Disconnect();
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:49,代码来源:IMAP.cs

示例5: TestIMAPServerNormal

 public void TestIMAPServerNormal()
 {
     IMAPSimulator sim = new IMAPSimulator();
     sim.ConnectAndLogon(GetUsername(), GetPassword());
     EnsureNoPassword();
 }
开发者ID:nberardi,项目名称:hMailServer,代码行数:6,代码来源:Security.PasswordMasking.cs

示例6: TestListWithReferenceTestCase2

        public void TestListWithReferenceTestCase2()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

              IMAPSimulator oSimulator = new IMAPSimulator();
              oSimulator.ConnectAndLogon(oAccount.Address, "test");
              oSimulator.CreateFolder("INBOX.MyApp.SubFolder1");
              oSimulator.CreateFolder("INBOX.MyApp.SubFolder2");
              oSimulator.CreateFolder("INBOX.SomeOtherFolder");

              string response = oSimulator.List("INBOX.MyApp", "%.%", true);
              Assert.IsFalse(response.Contains("\"INBOX.MyApp\""));
              Assert.IsFalse(response.Contains("\"INBOX.SomeOtherFolder\""));
              Assert.IsTrue(response.Contains("* LIST (\\HasNoChildren) \".\" \"INBOX.MyApp.SubFolder1\""));
              Assert.IsTrue(response.Contains("* LIST (\\HasNoChildren) \".\" \"INBOX.MyApp.SubFolder2\""));

              oSimulator.Disconnect();
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:18,代码来源:IMAP.Folders.cs

示例7: TestBodyStructureWithNonLatinCharacterTest3

        public void TestBodyStructureWithNonLatinCharacterTest3()
        {
            string @messageText =
            "To: [email protected]\r\n" +
            "Content-Type: multipart/mixed;\r\n" +
            " boundary=\"------------000008080307000003010005\"\r\n" +
            "\r\n" +
            "This is a multi-part message in MIME format.\r\n" +
            "--------------000008080307000003010005\r\n" +
            "Content-Type: text/plain; charset=ISO-8859-1; format=flowed\r\n" +
            "Content-Transfer-Encoding: 7bit\r\n" +
            "\r\n" +
            "Test\r\n" +
            "\r\n" +
            "--------------000008080307000003010005\r\n" +
            "Content-Type: image/png;\r\n" +
            " name=\"=?ISO-8859-1?Q?=F6=50=C4=C9=CD=C1=D6=60=F6=F6=E4=27=2E=70=6E=67?=\"\r\n" +
            "Content-Transfer-Encoding: base64\r\n" +
            "Content-Disposition: inline;\r\n" +
            " filename*=ISO-8859-1''%F6%50%C4%C9%CD%C1%D6%60%F6%F6%E4%27%2E%70%6E%67\r\n" +
            "\r\n" +
            "iVBORw0KGgoAAAANSUhEUgAAAqgAAAH4CAIAAAAJvIhhAAAAAXNSR0IArs4c6QAAAARnQU1B\r\n" +
            "AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA\r\n" +
            "--------------000008080307000003010005--\r\n";

             hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

             Assert.IsTrue(SMTPClientSimulator.StaticSendRaw(account.Address, account.Address, messageText));

             Utilities.AssertMessageExistsInFolder(account.IMAPFolders[0], 1);

             IMAPSimulator oSimulator = new IMAPSimulator();
             oSimulator.ConnectAndLogon(account.Address, "test");
             oSimulator.SelectFolder("INBOX");
             string result = oSimulator.Fetch("1 BODYSTRUCTURE");
             oSimulator.Disconnect();

             Assert.IsTrue(result.Contains("\"FILENAME\" \"=?ISO-8859-1?Q?=F6=50=C4=C9=CD=C1=D6=60=F6=F6=E4=27=2E=70=6E=67?=\""));
             Assert.IsTrue(result.Contains("\"NAME\" \"=?ISO-8859-1?Q?=F6=50=C4=C9=CD=C1=D6=60=F6=F6=E4=27=2E=70=6E=67?=\""));
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:40,代码来源:IMAP.cs

示例8: TestImportOfMessageIntoOtherFolder

        public void TestImportOfMessageIntoOtherFolder()
        {
            string @messageText =
               "From: [email protected]\r\n" +
               "\r\n" +
               "Test\r\n";

            hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

            account.IMAPFolders.Add("Woho");

            string domainPath = Path.Combine(_application.Settings.Directories.DataDirectory, "test.com");
            string accountPath = Path.Combine(domainPath, "test");

            Directory.CreateDirectory(accountPath);
            string fileName = Path.Combine(accountPath, "something.eml");

            File.WriteAllText(fileName, messageText);

            Assert.IsTrue(_application.Utilities.ImportMessageFromFileToIMAPFolder(fileName, account.ID, "Woho"));

            POP3Simulator.AssertMessageCount("[email protected]", "test", 0);
            IMAPSimulator sim = new IMAPSimulator();
            sim.ConnectAndLogon("[email protected]", "test");
            Assert.AreEqual(1, sim.GetMessageCount("Woho"));
            sim.Disconnect();
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:27,代码来源:API.Utilities.cs

示例9: TestBodyStructureWithNonLatinCharacterSingleLineEncoded

        public void TestBodyStructureWithNonLatinCharacterSingleLineEncoded()
        {
            string @messageText =
            "Message-ID: <[email protected]*******.**>\r\n" +
            "Date: Fri, 29 May 2009 11:53:03 +0200\r\n" +
            "Subject: attachment's name test\r\n" +
            "From: [email protected]\r\n" +
            "To: [email protected]\r\n" +
            "User-Agent: SquirrelMail/1.4.19\r\n" +
            "MIME-Version: 1.0\r\n" +
            "Content-Type: multipart/mixed;boundary=\"----=_20090529115303_60479\"\r\n" +
            "X-Priority: 3 (Normal)\r\n" +
            "Importance: Normal\r\n" +
            "\r\n" +
            "------=_20090529115303_60479\r\n" +
            "Content-Type: text/plain; charset=\"iso-8859-2\"\r\n" +
            "Content-Transfer-Encoding: 8bit\r\n" +
            "\r\n" +
            "test.±æê³ñ󶼿.txt\r\n" +
            "------=_20090529115303_60479\r\n" +
            "Content-Type: text/plain; name=\r\n" +
            "    =?iso-8859-2?Q?test.=B1=E6=EA=B3=F1=F3=B6=BC=BF.txt?=\r\n" +
            "Content-Transfer-Encoding: 8bit\r\n" +
            "Content-Disposition: attachment; filename=\"\r\n" +
            "    =?iso-8859-2?Q?test.=B1=E6=EA=B3=F1=F3=B6=BC=BF.txt?=\"\r\n" +
            "\r\n" +
            "1234\r\n" +
            "------=_20090529115303_60479--\r\n";

             hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

             Assert.IsTrue(SMTPClientSimulator.StaticSendRaw(account.Address, account.Address, messageText));

             Utilities.AssertMessageExistsInFolder(account.IMAPFolders[0], 1);

             IMAPSimulator oSimulator = new IMAPSimulator();
             oSimulator.ConnectAndLogon(account.Address, "test");
             oSimulator.SelectFolder("INBOX");
             string result = oSimulator.Fetch("1 BODYSTRUCTURE");
             oSimulator.Disconnect();

             Assert.IsTrue(result.Contains("(\"NAME\" \"=?iso-8859-2?Q?test.=B1=E6=EA=B3=F1=F3=B6=BC=BF.txt?=\")"));
             Assert.IsTrue(result.Contains("(\"FILENAME\" \"=?iso-8859-2?Q?test.=B1=E6=EA=B3=F1=F3=B6=BC=BF.txt?=\")"));
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:44,代码来源:IMAP.cs

示例10: TestBodyStructureWithNonLatinCharacterSingleLineWithSpace

        public void TestBodyStructureWithNonLatinCharacterSingleLineWithSpace()
        {
            string @messageText =
            "Return-Path: [email protected]\r\n" +
            "Delivered-To: [email protected]\r\n" +
            "Received: from www.hmailserver.com ([127.0.0.1])\r\n" +
            "	by mail.hmailserver.com\r\n" +
            "	; Tue, 16 Jun 2009 21:39:18 +0200\r\n" +
            "MIME-Version: 1.0\r\n" +
            "Date: Tue, 16 Jun 2009 21:39:18 +0200\r\n" +
            "From: <[email protected]>\r\n" +
            "To: <[email protected]>\r\n" +
            "Subject: sdafsda\r\n" +
            "Message-ID: <[email protected]>\r\n" +
            "X-Sender: [email protected]\r\n" +
            "User-Agent: RoundCube Webmail/0.2.2\r\n" +
            "Content-Type: multipart/mixed;\r\n" +
            "	boundary=\"=_b63968892a76b1a5be17f4d37b085f54\"\r\n" +
            "\r\n" +
            "--=_b63968892a76b1a5be17f4d37b085f54\r\n" +
            "Content-Transfer-Encoding: 8bit\r\n" +
            "Content-Type: text/plain; charset=\"UTF-8\"\r\n" +
            "\r\n" +
            "--=_b63968892a76b1a5be17f4d37b085f54\r\n" +
            "Content-Transfer-Encoding: base64\r\n" +
            "Content-Type: application/x-zip; charset=\"UTF-8\";\r\n" +
            " name*=\"UTF-8''m%C3%A4%C3%B6 m%C3%A4%C3%B6.zip\"; \r\n" +
            "Content-Disposition: attachment;\r\n" +
            " filename*=\"UTF-8''m%C3%A4%C3%B6 m%C3%A4%C3%B6.zip\"; \r\n" +
            "\r\n" +
            "iVBORw0KGgoAAAANSUhEUgAAAqgAAAH4CAIAAAAJvIhhAAAAAXNSR0IArs4c6QAAAARnQU1BAACx\r\n" +
            "jwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAIr1JREFU\r\n" +
            "eF7t29GSYzluBND1/3/0ejb6wY6emK2WrpQEkaefdQvAAcn02OH/+fe///0v/wgQIECAAIESgb+C\r\n" +
            "3z8CBAgQIECgROBfJXMakwABAgQIEPjP/5qfAgECBAgQINAjIPh7dm1SAgQIECDgv/idAQIECBAg\r\n" +
            "--=_b63968892a76b1a5be17f4d37b085f54--\r\n" +
            "";

             hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

             Assert.IsTrue(SMTPClientSimulator.StaticSendRaw(account.Address, account.Address, messageText));

             Utilities.AssertMessageExistsInFolder(account.IMAPFolders[0], 1);

             IMAPSimulator oSimulator = new IMAPSimulator();
             oSimulator.ConnectAndLogon(account.Address, "test");
             oSimulator.SelectFolder("INBOX");
             string result = oSimulator.Fetch("1 BODYSTRUCTURE");
             oSimulator.Disconnect();

             Assert.IsFalse(result.Contains("''"), result);
             Assert.IsTrue(result.Contains("\"FILENAME\" \"=?UTF-8?Q?m=C3=A4=C3=B6 m=C3=A4=C3=B6.zip?=\""), result);
             Assert.IsTrue(result.Contains("\"NAME\" \"=?UTF-8?Q?m=C3=A4=C3=B6 m=C3=A4=C3=B6.zip?=\""), result);
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:53,代码来源:IMAP.cs

示例11: TestBodyStructureWithNonLatinCharacterInAttachmentHeader

        public void TestBodyStructureWithNonLatinCharacterInAttachmentHeader()
        {
            string @messageText =
            "From: \"Test\" <[email protected]>"+ "\r\n" +
            "To: \"Test\" <[email protected]>" + "\r\n" +
            "Subject: test" + "\r\n" +
            "MIME-Version: 1.0" + "\r\n" +
            "Content-Type: multipart/mixed;" + "\r\n" +
            "   boundary=\"----=_NextPart_000_000C_01C9EEB2.08D2EC80\"" + "\r\n" +
            "X-Priority: 3" + "\r\n" +
            "" + "\r\n" +
            "This is a multi-part message in MIME format." + "\r\n" +
            "" + "\r\n" +
            "------=_NextPart_000_000C_01C9EEB2.08D2EC80" + "\r\n" +
            "Content-Type: text/plain;" + "\r\n" +
            "  format=flowed;" + "\r\n" +
            "	charset=\"iso-8859-1\";" + "\r\n" +
            "	reply-type=original" + "\r\n" +
            "Content-Transfer-Encoding: 7bit" + "\r\n" +
            "" + "\r\n" +
            "" + "\r\n" +
            "------=_NextPart_000_000C_01C9EEB2.08D2EC80" + "\r\n" +
            "Content-Type: application/octet-stream;" + "\r\n" +
            "	name=\"=?iso-8859-1?B?beT2LnppcA==?=\"" + "\r\n" +
            "Content-Transfer-Encoding: base64" + "\r\n" +
            "Content-Disposition: attachment;" + "\r\n" +
            "	filename=\"=?iso-8859-1?B?beT2LnppcA==?=\"" + "\r\n" +
            "" + "\r\n" +
            "iVBORw0KGgoAAAANSUhEUgAAAqgAAAH4CAIAAAAJvIhhAAAAAXNSR0IArs4c6QAAAARnQU1BAACx" + "\r\n" +
            "uIDgj5MrSIAAAQIEzgkI/nP2KhMgQIAAgbiA4I+TK0iAAAECBM4JCP5z9ioTIECAAIG4wP8ChvJS" + "\r\n" +
            "wXUaKVoAAAAASUVORK5CYII=" + "\r\n" +
            "" + "\r\n" +
            "------=_NextPart_000_000C_01C9EEB2.08D2EC80--" + "\r\n";

             hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

             Assert.IsTrue(SMTPClientSimulator.StaticSendRaw(account.Address, account.Address, messageText));

             Utilities.AssertMessageExistsInFolder(account.IMAPFolders[0], 1);

             IMAPSimulator oSimulator = new IMAPSimulator();
             oSimulator.ConnectAndLogon(account.Address, "test");
             oSimulator.SelectFolder("INBOX");
             string result = oSimulator.Fetch("1 BODYSTRUCTURE");
             oSimulator.Disconnect();

             Assert.IsTrue(result.Contains("(\"NAME\" \"=?iso-8859-1?B?beT2LnppcA==?=\")"));
             Assert.IsTrue(result.Contains("(\"FILENAME\" \"=?iso-8859-1?B?beT2LnppcA==?=\")"));

             string fileName = account.IMAPFolders.get_ItemByName("INBOX").Messages[0].Attachments[0].Filename;
             Assert.AreEqual("mäö.zip", fileName);
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:52,代码来源:IMAP.cs

示例12: TestUnseenResponseInSelect

        public void TestUnseenResponseInSelect()
        {
            hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

             SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "TestMessage");

             IMAPSimulator.AssertMessageCount(account.Address, "test", "Inbox", 1);

             IMAPSimulator sim = new IMAPSimulator();
             Assert.IsTrue(sim.ConnectAndLogon(account.Address, "test"));
             Assert.IsTrue(sim.SelectFolder("Inbox"));
             Assert.IsTrue(sim.CreateFolder("Dummy"));
             Assert.IsTrue(sim.Copy(1, "Dummy"));

             string result = sim.SendSingleCommand("a01 select Dummy");
             Assert.IsTrue(result.Contains("* 1 EXISTS\r\n* 1 RECENT"), result);

             string searchResponse = sim.SendSingleCommand("srch1 SEARCH ALL UNSEEN");

             // We should have at least one message here.
             Assert.IsTrue(searchResponse.Contains("* SEARCH 1\r\n"), searchResponse);

             // Now fetch the body.
             string bodyText = sim.Fetch("1 BODY[TEXT]");

             // Now the message is no longer unseen. Confirm this.
             searchResponse = sim.SendSingleCommand("srch1 SEARCH ALL UNSEEN");
             Assert.IsTrue(searchResponse.Contains("* SEARCH\r\n"), searchResponse);

             // Close the messages to mark them as no longer recent.
             Assert.IsTrue(sim.Close());

             result = sim.SendSingleCommand("a01 select Dummy");
             Assert.IsTrue(result.Contains("* 1 EXISTS\r\n* 0 RECENT"), result);
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:35,代码来源:IMAP.cs

示例13: TestRecentRemovedOnMailboxClose

        public void TestRecentRemovedOnMailboxClose()
        {
            hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

             SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "TestMessage");
             IMAPSimulator.AssertMessageCount(account.Address, "test", "Inbox", 1);

             IMAPSimulator sim = new IMAPSimulator();
             Assert.IsTrue(sim.ConnectAndLogon(account.Address, "test"));
             Assert.IsTrue(sim.SelectFolder("Inbox"));
             Assert.IsTrue(sim.CreateFolder("Dummy"));
             Assert.IsTrue(sim.Copy(1, "Dummy"));
             string result = sim.SendSingleCommand("a01 select Dummy");
             Assert.IsTrue(result.Contains("* 1 EXISTS\r\n* 1 RECENT"), result);
             Assert.IsTrue(sim.Logout());

             sim = new IMAPSimulator();
             Assert.IsTrue(sim.ConnectAndLogon(account.Address, "test"));
             result = sim.SendSingleCommand("a01 select Dummy");
             Assert.IsFalse(result.Contains("* 1 EXISTS\r\n* 1 RECENT"), result);
             Assert.IsTrue(sim.Logout());
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:22,代码来源:IMAP.cs

示例14: TestSearchUSASCII

        public void TestSearchUSASCII()
        {
            hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

             SMTPClientSimulator.StaticSend(account.Address, account.Address, "MySubject", "MyBody");

             POP3Simulator.AssertMessageCount(account.Address, "test", 1);

             IMAPSimulator oSimulator = new IMAPSimulator();
             Assert.IsTrue(oSimulator.ConnectAndLogon(account.Address, "test"));
             Assert.IsTrue(oSimulator.SelectFolder("INBOX"));

             string result = oSimulator.Search("CHARSET US-ASCII ALL SUBJECT MySubject");
             Assert.AreEqual("1", result);

             result = oSimulator.Search("CHARSET US-ASCII ALL SUBJECT MySubjact");
             Assert.AreEqual("", result);
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:18,代码来源:IMAP.Search.cs

示例15: TestDeleteIMAPFolderNotifications

        public void TestDeleteIMAPFolderNotifications()
        {
            _settings.IMAPIdleEnabled = true;

              hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "[email protected]", "test");

              IMAPSimulator oSimulator1 = new IMAPSimulator();
              IMAPSimulator oSimulator2 = new IMAPSimulator();
              oSimulator1.ConnectAndLogon(oAccount.Address, "test");
              oSimulator2.ConnectAndLogon(oAccount.Address, "test");

              oSimulator1.SelectFolder("Inbox");
              oSimulator2.CreateFolder("Mailbox");
              oSimulator2.DeleteFolder("Mailbox");

              SMTPClientSimulator.StaticSend("[email protected]", oAccount.Address, "Test", "test");

              POP3Simulator.AssertMessageCount(oAccount.Address, "test", 1);

              string noopResponse = oSimulator1.NOOP() + oSimulator1.NOOP();

              // confirm that the client is notified about this message even though another
              // folder has been dropped by another client.
              Assert.IsTrue(noopResponse.Contains(@"* 1 EXISTS"), noopResponse);
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:25,代码来源:IMAP.cs


注:本文中的IMAPSimulator.ConnectAndLogon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。