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


C# IMAPSimulator.GetMessageCount方法代码示例

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


在下文中一共展示了IMAPSimulator.GetMessageCount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: ConfirmFileAddedToCorrectPublicFolder

        public void ConfirmFileAddedToCorrectPublicFolder()
        {
            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);

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

            // Give everyone access to the folder.
            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.ePermissionInsert, true);
            permission.Save();

            // Add the message to the public folder.
            oSimulator.Connect();
            oSimulator.LogonWithLiteral("[email protected]", "test");
            oSimulator.SendSingleCommandWithLiteral("A01 APPEND #Public.Share {4}", "ABCD");

            // Confirm that the message exists in the public folder and not in the inbox.
            Assert.AreEqual(1, oSimulator.GetMessageCount("#Public.Share"));
            Assert.AreEqual(0, oSimulator.GetMessageCount("INBOX"));
            oSimulator.Disconnect();

            // The public directory should now contain the message.
            utilities.AssertFilesInDirectory(publicDir, 1);

            // There users directory should still be empty.
            utilities.AssertFilesInUserDirectory(oAccount, 0);
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:38,代码来源:IMAP.Append.cs

示例4: 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

示例5: TestAppendResponseContainsExists

        public void TestAppendResponseContainsExists()
        {
            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 response1 = oSimulator.SendSingleCommandWithLiteral("A01 APPEND INBOX {4}", "ABCD");
             Assert.IsTrue(response1.Contains("* 1 EXISTS"), response1);
             Assert.IsTrue(response1.Contains("* 1 RECENT"), response1);
             Assert.AreEqual(1, oSimulator.GetMessageCount("INBOX"));
             oSimulator.Disconnect();
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:15,代码来源:IMAP.cs

示例6: TestAppendToPublicFolder

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

              hMailServer.Account account = 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 = account.ID;
              permission.PermissionType = hMailServer.eACLPermissionType.ePermissionTypeUser;
              permission.set_Permission(hMailServer.eACLPermission.ePermissionLookup, true);
              permission.set_Permission(hMailServer.eACLPermission.ePermissionRead, true);
              permission.set_Permission(hMailServer.eACLPermission.ePermissionInsert, true);
              permission.set_Permission(hMailServer.eACLPermission.ePermissionPost, true);
              permission.Save();

              IMAPSimulator oSimulator = new IMAPSimulator();

              string sWelcomeMessage = oSimulator.Connect();
              oSimulator.LogonWithLiteral(account.Address, "test");
              oSimulator.SendSingleCommandWithLiteral("A01 APPEND #Public.Share1 {4}", "ABCD");
              Assert.AreEqual(1, oSimulator.GetMessageCount("#Public.Share1"));
              oSimulator.Disconnect();
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:27,代码来源:IMAP.ACL.cs


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