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


C# IMAPSimulator类代码示例

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


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

示例1: ConfirmFileAddedToCorrectAccountFolder

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

            // Confirm that the public folder is empty before we start our test.
            string publicDir = utilities.GetPublicDirectory();
            utilities.AssertFilesInDirectory(publicDir, 0);

            // Add a message to the inbox.
            oSimulator.Connect();
            oSimulator.LogonWithLiteral("[email protected]", "test");
            oSimulator.SendSingleCommandWithLiteral("A01 APPEND INBOX {4}", "ABCD");

            // Confirm it exists in the IMAP folder.
            Assert.AreEqual(1, oSimulator.GetMessageCount("INBOX"));
            oSimulator.Disconnect();

            // The public directory should still be empty - the message was added to the user account.
            utilities.AssertFilesInDirectory(publicDir, 0);

            // There should be a single file in the users directory.
            utilities.AssertFilesInUserDirectory(oAccount, 1);
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:25,代码来源:IMAP.Append.cs

示例2: ExamineFolderRequiresReadPermission

        public void ExamineFolderRequiresReadPermission()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();

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

             hMailServer.IMAPFolders publicFolders = _settings.PublicFolders;
             hMailServer.IMAPFolder folder = publicFolders.Add("Share1");
             folder.Save();

             hMailServer.IMAPFolderPermission permission = folder.Permissions.Add();
             permission.PermissionAccountID = account1.ID;
             permission.PermissionType = hMailServer.eACLPermissionType.ePermissionTypeUser;
             permission.set_Permission(hMailServer.eACLPermission.ePermissionLookup, true);
             permission.Save();

             string selectResult = string.Empty;

             IMAPSimulator oSimulator1 = new IMAPSimulator();
             oSimulator1.Connect();
             oSimulator1.LogonWithLiteral(account1.Address, "test");
             string examineResult = oSimulator1.ExamineFolder("#Public.Share1");
             oSimulator1.Disconnect();

             Assert.IsTrue(examineResult.Contains("ACL: Read permission denied (Required for EXAMINE command)."), examineResult);
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:26,代码来源:IMAP.ACL.cs

示例3: TestMetaDataSortCC

        public void TestMetaDataSortCC()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();
             hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "meta'[email protected]", "test");

             // disable...
             SendMessage("Test C", "Body", "", "ÄÄÄ");
             IMAPSimulator.AssertMessageCount(account.Address, "test", "Inbox", 1);

             SendMessage("Test B", "Body", "", "ÖÖÖ");
             IMAPSimulator.AssertMessageCount(account.Address, "test", "Inbox", 2);

             SendMessage("Test A", "Body", "", "ÅÅÅ");
             IMAPSimulator.AssertMessageCount(account.Address, "test", "Inbox", 3);

             AssertAllMessagesIndexed();

             IMAPSimulator sim = new IMAPSimulator(account.Address, "test", "Inbox");

             string result = sim.Sort("(CC) UTF-8 ALL");

             Assert.AreEqual("3 1 2", result);

             // Disable the indexing functionality
             _indexing.Enabled = false;
             _indexing.Clear();

             // Make sure the sort order is the same.
             string resultAfter = sim.Sort("(CC) UTF-8 ALL");

             Assert.AreEqual(result, resultAfter);
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:32,代码来源:IMAP.MessageIndexing.cs

示例4: TestNestedOrSearch

        public void TestNestedOrSearch()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();

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

              // Send a message to this account.
              SMTPClientSimulator oSMTP = new SMTPClientSimulator();
              oSMTP.Send("[email protected]", "[email protected]", "Search test", "This is a test of IMAP Search");

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

              IMAPSimulator oSimulator = new IMAPSimulator();
              string sWelcomeMessage = oSimulator.Connect();
              oSimulator.Logon("[email protected]", "test");
              oSimulator.SelectFolder("INBOX");

              string result = oSimulator.SendSingleCommand("A4 SEARCH ALL OR OR SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008");
              Assert.IsTrue(result.StartsWith("* SEARCH 1"), result);

              result = oSimulator.SendSingleCommand("A4 SEARCH ALL OR SMALLER 1 LARGER 10000");
              Assert.IsTrue(result.StartsWith("* SEARCH\r\n"), result);

              result = oSimulator.SendSingleCommand("A4 SEARCH ALL OR OR SMALLER 1 LARGER 10000 SMALLER 10000");
              Assert.IsTrue(result.StartsWith("* SEARCH 1\r\n"), result);
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:27,代码来源:IMAP.Search.cs

示例5: TestDateSortOrderNonexistantDate

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

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral("[email protected]", "test");
             Assert.IsTrue(oSimulator.SelectFolder("Inbox"));

             string response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 22:00:00 +0200\" {4}", "ABCD");
             Assert.IsTrue(response.Contains("* 1 EXISTS"), response);

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 21:00:00 +0200\" {4}", "ABCD");
             Assert.IsTrue(response.Contains("* 2 EXISTS"), response);

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 20:00:00 +0200\" {4}", "ABCD");
             Assert.IsTrue(response.Contains("* 3 EXISTS"), response);

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"23-Feb-2008 01:30:23 +0200\" {4}", "ABCD");
             Assert.IsTrue(response.Contains("* 4 EXISTS"), response);

             /*
              * RFC 5256 "2.2. Sent Date" chapter. If the sent date cannot be determined (a Date: header is missing or cannot be parsed),
              * the INTERNALDATE for that message is used as the sent date.
              */

             string sortDateResponse = oSimulator.SendSingleCommand("A10 SORT (DATE) US-ASCII ALL");
             string sortArivalDateResponse = oSimulator.SendSingleCommand("A10 SORT (ARRIVAL) US-ASCII ALL");

             Assert.IsTrue(sortArivalDateResponse.Contains(" 3 2 1 4"));
             Assert.AreEqual(sortDateResponse, sortArivalDateResponse);
             oSimulator.Disconnect();
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:33,代码来源:IMAP.Sort.cs

示例6: TestDateSortOrder

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

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral("[email protected]", "test");
             Assert.IsTrue(oSimulator.SelectFolder("Inbox"));

             string response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 22:00:00 +0200\" {37}", "Date: Wed, 15 Dec 2010 13:00:00 +0000");
             Assert.IsTrue(response.Contains("* 1 EXISTS"), response);

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 21:00:00 +0200\" {37}", "Date: Wed, 15 Dec 2010 14:00:00 +0000");
             Assert.IsTrue(response.Contains("* 2 EXISTS"), response);

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 20:00:00 +0200\" {37}", "Date: Wed, 15 Dec 2010 12:00:00 +0000");
             Assert.IsTrue(response.Contains("* 3 EXISTS"), response);

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"23-Feb-2008 01:30:23 +0200\" {37}", "Date: Wed, 15 Dec 2010 11:00:00 +0000");
             Assert.IsTrue(response.Contains("* 4 EXISTS"), response);

             string sortDateResponse = oSimulator.SendSingleCommand("A10 SORT (DATE) US-ASCII ALL");

             Assert.IsTrue(sortDateResponse.Contains(" 4 3 1 2"));
             oSimulator.Disconnect();
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:26,代码来源:IMAP.Sort.cs

示例7: TestAppendFolderNameInOctetNoFlagList

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

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon("[email protected]", "test");
             oSimulator.SelectFolder("INBOX");
             oSimulator.CreateFolder("MONK");
             oSimulator.SendRaw("A01 APPEND {4}\r\n");
             string result = oSimulator.Receive();
             Assert.IsTrue(result.StartsWith("+ Ready for additional command text."));

             oSimulator.SendRaw("MONK  \"12-Jan-2009 12:12:12 +0100\" {5}\r\n");
             result = oSimulator.Receive();
             Assert.IsTrue(result.StartsWith("+ Ready for literal data"));

             oSimulator.SendRaw("WOOOT\r\n");
             result = oSimulator.Receive();

             Assert.AreEqual("A01 OK APPEND completed\r\n", result);

             DateTime date = Convert.ToDateTime(oAccount.IMAPFolders.get_ItemByName("MONK").Messages[0].InternalDate);

             Assert.AreEqual(2009, date.Year);
             Assert.AreEqual(12, date.Day);
             Assert.AreEqual(1, date.Month);
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:29,代码来源:IMAP.cs

示例8: FolderMarkedAsReadOnlyWhenUserHasReadOnlyRights

        public void FolderMarkedAsReadOnlyWhenUserHasReadOnlyRights()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();

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

             hMailServer.IMAPFolders publicFolders = _settings.PublicFolders;
             hMailServer.IMAPFolder folder = publicFolders.Add("Share1");
             folder.Save();

             hMailServer.IMAPFolderPermission permission = folder.Permissions.Add();
             permission.PermissionAccountID = account1.ID;
             permission.PermissionType = hMailServer.eACLPermissionType.ePermissionTypeUser;
             permission.set_Permission(hMailServer.eACLPermission.ePermissionLookup, true);
             permission.set_Permission(hMailServer.eACLPermission.ePermissionRead, true);
             permission.Save();

             string selectResult = string.Empty;

             IMAPSimulator oSimulator1 = new IMAPSimulator();
             oSimulator1.Connect();
             oSimulator1.LogonWithLiteral(account1.Address, "test");
             oSimulator1.SelectFolder("#Public.Share1", out selectResult);
             oSimulator1.Disconnect();

             Assert.IsTrue(selectResult.Contains("[READ-ONLY]"), selectResult);
             Assert.IsFalse(selectResult.Contains("[READ-WRITE]"), selectResult);
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:28,代码来源:IMAP.ACL.cs

示例9: TestIMAPServerLiteral

 public void TestIMAPServerLiteral()
 {
     IMAPSimulator sim = new IMAPSimulator();
     sim.Connect();
     Assert.IsTrue(sim.Send("a01 login " + GetUsername() + " {4}").StartsWith("+"));
     sim.Send(GetPassword());
     EnsureNoPassword();
 }
开发者ID:nberardi,项目名称:hMailServer,代码行数:8,代码来源:Security.PasswordMasking.cs

示例10: TestAppendBadLiteral

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

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral("[email protected]", "test");
             oSimulator.SendSingleCommandWithLiteral("A01 APPEND INBOX {TEST}", "ABCD");
             Assert.AreEqual(0, oSimulator.GetMessageCount("INBOX"));
             oSimulator.Disconnect();
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:12,代码来源:IMAP.cs

示例11: TestCreateFolderWithHash

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

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon(oAccount.Address, "test");
             Assert.IsFalse(oSimulator.CreateFolder("#Test"));
             Assert.IsTrue(oSimulator.CreateFolder("Test.#Testar"));
             oSimulator.Disconnect();
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:12,代码来源:IMAP.Folders.cs

示例12: TestCreateDeepFolder

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

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral(oAccount.Address, "test");
             string result = oSimulator.Send("A01 CREATE 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26");
             Assert.IsTrue(result.Contains("A01 NO"));

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

示例13: TestCreateFolderWithSlash

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

              string folderName = "ABC\\123";

              IMAPSimulator oSimulator = new IMAPSimulator();
              string sWelcomeMessage = oSimulator.Connect();
              oSimulator.Logon(oAccount.Address, "test");
              Assert.IsTrue(oSimulator.CreateFolder(folderName));
              Assert.IsTrue(oSimulator.List().Contains(folderName));
              Assert.IsTrue(oSimulator.SelectFolder(folderName));
              oSimulator.Disconnect();
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:14,代码来源:IMAP.Folders.cs

示例14: TestFetchCharsetInQuotesWithoutSpace

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

             SMTPClientSimulator.StaticSendRaw(account.Address, account.Address,
            "From: [email protected]\r\n" +
            "Content-Type: text/plain; charset =\"iso-8859-1\"\r\n" +
            "\r\n" +
            "Test\r\n");

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

             IMAPSimulator sim = new IMAPSimulator(account.Address, "test", "Inbox");
             string result = sim.Fetch("1 BODYSTRUCTURE");
             sim.Disconnect();

             Assert.IsTrue(result.Contains("(\"CHARSET\" \"iso-8859-1\")"), result);
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:18,代码来源:MIME.Parameters.cs

示例15: TestHierarchyDelimiterListResponse

        public void TestHierarchyDelimiterListResponse()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();
            hMailServer.Settings settings = _settings;
            settings.IMAPHierarchyDelimiter = "\\";

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

            string folderName = "Test\\Test";

            IMAPSimulator oSimulator = new IMAPSimulator();
            string sWelcomeMessage = oSimulator.Connect();
            oSimulator.Logon(account.Address, "test");
            Assert.IsTrue(oSimulator.CreateFolder(folderName));
            string listResponse = oSimulator.List();
            Assert.IsTrue(listResponse.Contains("\"Test\\Test\""));
            Assert.IsTrue(listResponse.Contains("\"Test\""));
            oSimulator.Disconnect();
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:19,代码来源:IMAP.HierarchyDelimiter.cs


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