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


C# ImapClientSimulator.CreateFolder方法代码示例

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


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

示例1: TestCreateFolderWithHash

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

             var oSimulator = new ImapClientSimulator();

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

示例2: TestIMAPServer

        public void TestIMAPServer()
        {
            LogHandler.DeleteCurrentDefaultLog();

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

             for (int i = 0; i < 30; i++)
             {
            try
            {
               var imapSim = new ImapClientSimulator(true, 14301);
               imapSim.ConnectAndLogon(account.Address, "test");
               Assert.IsTrue(imapSim.SelectFolder("Inbox"), "SelectInbox");
               imapSim.CreateFolder("Test");
               Assert.IsTrue(imapSim.SelectFolder("Test"), "SelectTest");
               Assert.IsTrue(imapSim.Logout(), "Logout");

               imapSim.Disconnect();
               break;
            }
            catch (Exception)
            {
               if (i == 29)
                  throw;
            }
             }
        }
开发者ID:baa-archieve,项目名称:hmailserver,代码行数:27,代码来源:SslServerTests.cs

示例3: SetupEnvWith50MillionMessages

        public void SetupEnvWith50MillionMessages()
        {
            const int accountCount = 1;
             const int folderCount = 1;
             const int messageCount = 100000;

             var accounts = new List<string>();
             for (int accountIdx = 0; accountIdx < accountCount; accountIdx++)
             {
            var account = string.Format("test-{0}@test.com", accountIdx);
            accounts.Add(account);

            TestTracer.WriteTraceInfo("Setting up {0}...", account);
            SingletonProvider<TestSetup>.Instance.AddAccount(_domain, account, "test");
             }

             var folders = new List<string>();
             for (int folderIdx = 0; folderIdx < folderCount; folderIdx++)
            folders.Add(string.Format("Folder-{0}", folderIdx));

             var parallelOptions = new ParallelOptions();
             parallelOptions.MaxDegreeOfParallelism = 10;

             var watch = new Stopwatch();
             watch.Start();

             Parallel.ForEach(accounts, parallelOptions, account =>
            {
               TestTracer.WriteTraceInfo("Processing messages for {0}...", account);

               var sim = new ImapClientSimulator();
               Assert.IsTrue(sim.ConnectAndLogon(account, "test"));

               foreach (var folder in folders)
               {
                  Assert.IsTrue(sim.CreateFolder(folder));

                  for (int i = 0; i < messageCount; i++)
                  {
                     string f = sim.SendSingleCommandWithLiteral("A01 APPEND " + folder + " {1}", "A");
                     Assert.IsTrue(f.Contains("A01 OK APPEND completed"), f);
                  }
               }

               sim.Disconnect();
            });

             watch.Stop();
             TestTracer.WriteTraceInfo(watch.ElapsedMilliseconds.ToString());
        }
开发者ID:SpivEgin,项目名称:hmailserver,代码行数:50,代码来源:PerfTestEnvironmentSetUp.cs

示例4: TestCreateFolderWithSlash

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

             const string folderName = "ABC\\123";

             var oSimulator = new ImapClientSimulator();
             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:SpivEgin,项目名称:hmailserver,代码行数:14,代码来源:Folders.cs

示例5: TestHierarchyDelimiterListResponse

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

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

             string folderName = "Test\\Test";

             var oSimulator = new ImapClientSimulator();
             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:SpivEgin,项目名称:hmailserver,代码行数:19,代码来源:HierarchyDelimiter.cs

示例6: TestAppendFolderNameInOctet

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

             var oSimulator = new ImapClientSimulator();

             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 (\\Seen) \"20-Jan-2009 12:59:50 +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);
        }
开发者ID:baa-archieve,项目名称:hmailserver,代码行数:23,代码来源:Basics.cs

示例7: TestSetACLOnAccountFolder

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

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

             var imapClientSimulator = new ImapClientSimulator();
             imapClientSimulator.Connect();
             imapClientSimulator.LogonWithLiteral(account1.Address, "test");
             Assert.IsTrue(imapClientSimulator.CreateFolder("SharedFolder"));
             Assert.IsFalse(imapClientSimulator.SetACL("SharedFolder", account2.Address, "lrswipkxtea"));
             imapClientSimulator.Disconnect();
        }
开发者ID:SpivEgin,项目名称:hmailserver,代码行数:14,代码来源:ACL.cs

示例8: TestAppendFolderNameInOctetNoFlagList

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

             var oSimulator = new ImapClientSimulator();

             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:baa-archieve,项目名称:hmailserver,代码行数:29,代码来源:Basics.cs

示例9: TestRenamePublicFolderToRootPublicFolder

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

             Account account1 = 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 = account1.ID;
             permission.PermissionType = eACLPermissionType.ePermissionTypeUser;
             permission.set_Permission(eACLPermission.ePermissionCreate, true);
             permission.set_Permission(eACLPermission.ePermissionLookup, true);
             permission.set_Permission(eACLPermission.ePermissionDeleteMailbox, true);
             permission.Save();

             string oldFolderName = "#Public.Share1.MySub1";
             string newFolderName = "#Public.Share2";

             var imapClientSimulator = new ImapClientSimulator();
             imapClientSimulator.Connect();
             imapClientSimulator.Logon(account1.Address, "test");
             Assert.IsTrue(imapClientSimulator.CreateFolder(oldFolderName));
             Assert.IsFalse(imapClientSimulator.RenameFolder(oldFolderName, newFolderName));

             Assert.IsTrue(imapClientSimulator.List().Contains(oldFolderName));
             Assert.IsFalse(imapClientSimulator.List().Contains(newFolderName));

             imapClientSimulator.Disconnect();
        }
开发者ID:SpivEgin,项目名称:hmailserver,代码行数:32,代码来源:ACL.cs

示例10: TestPublicFolderSubscriptionCreate

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

             Account account1 = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
             Account account2 = 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 = account1.ID;
             permission.PermissionType = eACLPermissionType.ePermissionTypeUser;
             permission.set_Permission(eACLPermission.ePermissionCreate, true);
             permission.set_Permission(eACLPermission.ePermissionAdminister, true);
             permission.set_Permission(eACLPermission.ePermissionExpunge, true);
             permission.set_Permission(eACLPermission.ePermissionDeleteMailbox, true);
             permission.set_Permission(eACLPermission.ePermissionRead, true);
             permission.Save();

             var imapClientSimulator = new ImapClientSimulator();
             imapClientSimulator.Connect();
             imapClientSimulator.Logon(account1.Address, "test");
             string folderName = "#Public.Share1.MySub";
             imapClientSimulator.CreateFolder(folderName);

             IMAPFolder theNewFolder = folder.SubFolders[0];
             Assert.IsTrue(theNewFolder.Name.Equals("MySub"));
             Assert.IsTrue(theNewFolder.Subscribed);

             imapClientSimulator.Disconnect();
        }
开发者ID:SpivEgin,项目名称:hmailserver,代码行数:33,代码来源:ACL.cs

示例11: TestRenameToSubFolder

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

             var oSimulator = new ImapClientSimulator();

             oSimulator.Connect();
             oSimulator.LogonWithLiteral(oAccount.Address, "test");
             Assert.IsTrue(oSimulator.CreateFolder("1.2.3.4.5"));
             Assert.IsTrue(oSimulator.CreateFolder("A"));
             Assert.IsTrue(oSimulator.RenameFolder("1", "A.1"));
             Assert.IsTrue(oSimulator.SelectFolder("A.1"));
             Assert.IsTrue(oSimulator.SelectFolder("A.1.2.3.4.5"));
             Assert.IsTrue(oSimulator.RenameFolder("A.1", "1"));
             Assert.IsFalse(oSimulator.SelectFolder("A.1"));
             Assert.IsFalse(oSimulator.SelectFolder("A.1.2.3.4.5"));
             Assert.IsTrue(oSimulator.SelectFolder("1"));
             Assert.IsTrue(oSimulator.SelectFolder("1.2.3.4.5"));

             oSimulator.Disconnect();
        }
开发者ID:SpivEgin,项目名称:hmailserver,代码行数:21,代码来源:Folders.cs

示例12: TestCreateFolderWithSameNameAsPublic

        public void TestCreateFolderWithSameNameAsPublic()
        {
            Application application = SingletonProvider<TestSetup>.Instance.GetApp();
             string origPublicFolderName = _settings.IMAPPublicFolderName;

             _settings.IMAPPublicFolderName = "MyPublic";

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

            var imapClientSimulator = new ImapClientSimulator();
            imapClientSimulator.Connect();
            imapClientSimulator.Logon(account1.Address, "test");
            Assert.IsFalse(imapClientSimulator.CreateFolder("MyPublic"));
            imapClientSimulator.Disconnect();
             }
             finally
             {
            _settings.IMAPPublicFolderName = origPublicFolderName;
             }
        }
开发者ID:SpivEgin,项目名称:hmailserver,代码行数:23,代码来源:ACL.cs

示例13: TestDeleteSubFolderCheckAPI

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

             IMAPFolders publicFolders = _settings.PublicFolders;

             Assert.AreEqual(0, publicFolders.Count);

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

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

             Assert.AreEqual(1, publicFolders.Count);

             IMAPFolders mySubFolders = folder.SubFolders;
             Assert.AreEqual(0, mySubFolders.Count);

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

             var imapClientSimulator = new ImapClientSimulator();
             imapClientSimulator.ConnectAndLogon("[email protected]", "test");
             Assert.IsTrue(imapClientSimulator.CreateFolder("#public.Share1.MySub"));
             Assert.AreEqual(1, mySubFolders.Count);

             permission.set_Permission(eACLPermission.ePermissionDeleteMailbox, true);
             permission.Save();

             Assert.IsTrue(imapClientSimulator.DeleteFolder("#public.Share1.MySub"));
             Assert.IsFalse(imapClientSimulator.SelectFolder("#public.Share1.MySub"));

             Assert.AreEqual(0, mySubFolders.Count);
             Assert.AreEqual(1, publicFolders.Count);

             imapClientSimulator.Disconnect();
        }
开发者ID:SpivEgin,项目名称:hmailserver,代码行数:42,代码来源:ACL.cs

示例14: TestUnseenResponseInSelect

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

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

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

             var sim = new ImapClientSimulator();
             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:baa-archieve,项目名称:hmailserver,代码行数:35,代码来源:Basics.cs

示例15: TestUnsubscribe

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

             var oSimulator = new ImapClientSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon("[email protected]", "test");
             Assert.IsTrue(oSimulator.CreateFolder("TestFolder1"));
             Assert.IsTrue(oSimulator.CreateFolder("TestFolder2"));

             if (!oSimulator.Subscribe("TestFolder1"))
            Assert.Fail("Subscribe on existent folder failed");
             if (!oSimulator.Subscribe("TestFolder2"))
            Assert.Fail("Subscribe on existent folder failed");

             if (!oSimulator.Unsubscribe("TestFolder1"))
            Assert.Fail("Unsubscribe on existent folder failed");
             if (!oSimulator.Unsubscribe("TestFolder2"))
            Assert.Fail("Unsubscribe on existent folder failed");
        }
开发者ID:baa-archieve,项目名称:hmailserver,代码行数:21,代码来源:Basics.cs


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