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


C# IMAPClientSimulator.GetMessageCount方法代码示例

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


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

示例1: ConfirmFileAddedToCorrectAccountFolder

        public void ConfirmFileAddedToCorrectAccountFolder()
        {
            TestSetup testSetup = SingletonProvider<TestSetup>.Instance;
             Account oAccount = testSetup.AddAccount(_domain, "[email protected]", "test");
             var oSimulator = new IMAPClientSimulator();

             // Confirm that the public folder is empty before we start our test.
             string publicDir = testSetup.GetPublicDirectory();
             testSetup.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.
             CustomAssert.AreEqual(1, oSimulator.GetMessageCount("INBOX"));
             oSimulator.Disconnect();

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

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

示例2: TestAppendBadLiteral

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

             var oSimulator = new IMAPClientSimulator();

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

示例3: ConfirmFileAddedToCorrectPublicFolder

        public void ConfirmFileAddedToCorrectPublicFolder()
        {
            TestSetup testSetup = SingletonProvider<TestSetup>.Instance;
             Account oAccount = testSetup.AddAccount(_domain, "[email protected]", "test");
             var oSimulator = new IMAPClientSimulator();

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

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

             // Give everyone access to the folder.
             IMAPFolderPermission permission = folder.Permissions.Add();
             permission.PermissionType = eACLPermissionType.ePermissionTypeAnyone;
             permission.set_Permission(eACLPermission.ePermissionLookup, true);
             permission.set_Permission(eACLPermission.ePermissionRead, true);
             permission.set_Permission(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.
             CustomAssert.AreEqual(1, oSimulator.GetMessageCount("#Public.Share"));
             CustomAssert.AreEqual(0, oSimulator.GetMessageCount("INBOX"));
             oSimulator.Disconnect();

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

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

示例4: AssertMessageCount

        public static void AssertMessageCount(string accountName, string accountPassword, string folderName,
                                            int expectedCount)
        {
            if (expectedCount == 0)
             {
            // make sure that we aren't currently delivering messages.
            TestSetup.AssertRecipientsInDeliveryQueue(0);
             }

             var oIMAP = new IMAPClientSimulator();
             CustomAssert.IsTrue(oIMAP.ConnectAndLogon(accountName, accountPassword));

             if (expectedCount != 0)
            oIMAP.AssertFolderExists(folderName);

             int currentCount = 0;
             int timeout = 1000; // 1000 * 25 = 25 seconds.
             while (timeout > 0)
             {
            currentCount = oIMAP.GetMessageCount(folderName);

            if (currentCount > expectedCount)
               break;

            if (currentCount == expectedCount)
            {
               oIMAP.Disconnect();
               return;
            }

            timeout--;
            Thread.Sleep(25);
             }

             oIMAP.Disconnect();

             string error = "Wrong number of messages in mailbox " + folderName + " in account " + accountName +
                        " Actual: " + currentCount.ToString() + " Expected: " + expectedCount.ToString();
             CustomAssert.Fail(error);
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:40,代码来源:IMAPClientSimulator.cs

示例5: TestAppendToPublicFolder

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

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

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

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

             var oSimulator = new IMAPClientSimulator();

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

示例6: TestPOP3TransactionSafety

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

             CustomAssert.IsTrue(SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "TestBody"));
             POP3ClientSimulator.AssertMessageCount(account.Address, "test", 1);

             var sim = new POP3ClientSimulator();
             sim.ConnectAndLogon(account.Address, "test");

             // Now delete the message using an IMAP client.
             var imapSimulator = new IMAPClientSimulator();
             CustomAssert.IsTrue(imapSimulator.ConnectAndLogon(account.Address, "test"));
             CustomAssert.IsTrue(imapSimulator.SelectFolder("INBOX"));
             CustomAssert.IsTrue(imapSimulator.SetDeletedFlag(1));
             CustomAssert.IsTrue(imapSimulator.Expunge());
             CustomAssert.AreEqual(0, imapSimulator.GetMessageCount("Inbox"));

             CustomAssert.IsTrue(SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "TestBody"));
             IMAPClientSimulator.AssertMessageCount(account.Address, "test", "Inbox", 1);

             // This deletion should not have any effect, since the POP3 connection is referencing an old message.
             sim.DELE(1);
             sim.QUIT();

             CustomAssert.AreEqual(1, imapSimulator.GetMessageCount("Inbox"));
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:27,代码来源:Basics.cs

示例7: TestAppendResponseContainsExists

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

             var oSimulator = new IMAPClientSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral("[email protected]", "test");
             CustomAssert.IsTrue(oSimulator.SelectFolder("Inbox"));
             string response1 = oSimulator.SendSingleCommandWithLiteral("A01 APPEND INBOX {4}", "ABCD");
             CustomAssert.IsTrue(response1.Contains("* 1 EXISTS"), response1);
             CustomAssert.IsTrue(response1.Contains("* 1 RECENT"), response1);
             CustomAssert.AreEqual(1, oSimulator.GetMessageCount("INBOX"));
             oSimulator.Disconnect();
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:15,代码来源:Basics.cs

示例8: TestImportOfMessageIntoOtherFolder

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

             Account account = SingletonProvider<TestSetup>.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);

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

             POP3ClientSimulator.AssertMessageCount("[email protected]", "test", 0);
             var sim = new IMAPClientSimulator();
             sim.ConnectAndLogon("[email protected]", "test");
             CustomAssert.AreEqual(1, sim.GetMessageCount("Woho"));
             sim.Disconnect();
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:27,代码来源:Utilities.cs


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