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


C# IMAPSimulator.RenameFolder方法代码示例

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


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

示例1: TestRenameToSubFolder

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

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = 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:nberardi,项目名称:hMailServer,代码行数:21,代码来源:IMAP.Folders.cs

示例2: TestHierarchyDelimiterRename

        public void TestHierarchyDelimiterRename()
        {
            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";
            string newFolderName = "Apa/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("\"" + folderName + "\""));
            Assert.IsTrue(listResponse.Contains("\"Test\""));
            Assert.IsTrue(oSimulator.RenameFolder("Test", "Apa"));
            listResponse = oSimulator.List();
            Assert.IsTrue(listResponse.Contains("\"" + newFolderName + "\""));
            Assert.IsTrue(listResponse.Contains("\"Apa\""));
            oSimulator.Disconnect();
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:24,代码来源:IMAP.HierarchyDelimiter.cs

示例3: TestRenameToAndFromINBOX

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

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral(oAccount.Address, "test");
             oSimulator.Send("A01 CREATE A\r\n");
             Assert.IsFalse(oSimulator.RenameFolder("A", "INBOX"));
             Assert.IsFalse(oSimulator.RenameFolder("INBOX", "B"));

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

示例4: TestRenameToParallelFolder

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

              IMAPSimulator oSimulator = new IMAPSimulator();

              string sWelcomeMessage = oSimulator.Connect();
              oSimulator.LogonWithLiteral(oAccount.Address, "test");
              Assert.IsTrue(oSimulator.CreateFolder("Main.Sub"));
              Assert.IsTrue(oSimulator.RenameFolder("Main.Sub", "Second.Sub"));

              string listResponse = oSimulator.List();
              Assert.IsFalse(listResponse.Contains("Main.Sub"));
              Assert.IsTrue(listResponse.Contains("Second.Sub"));

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

示例5: TestRenameRootPublicFolder

        public void TestRenameRootPublicFolder()
        {
            hMailServer.IMAPFolders folders = _application.Settings.PublicFolders;
             hMailServer.IMAPFolder folder = folders.Add("ShareA");
             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.ePermissionDeleteMailbox, true);
             permission.Save();

             hMailServer.IMAPFolder folder2 = folders.Add("ShareB");
             folder2.Save();

             hMailServer.IMAPFolderPermission permission2 = folder2.Permissions.Add();
             permission2.PermissionType = hMailServer.eACLPermissionType.ePermissionTypeAnyone;
             permission2.set_Permission(hMailServer.eACLPermission.ePermissionLookup, true);
             permission2.set_Permission(hMailServer.eACLPermission.ePermissionRead, true);
             permission2.set_Permission(hMailServer.eACLPermission.ePermissionDeleteMailbox, true);
             permission2.Save();

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

             IMAPSimulator simulator1 = new IMAPSimulator();
             simulator1.ConnectAndLogon(account.Address, "test");
             Assert.IsTrue(simulator1.SelectFolder("#Public.ShareA"));
             Assert.IsTrue(simulator1.SelectFolder("#Public.ShareB"));
             Assert.IsTrue(simulator1.RenameFolder("#Public.ShareA", "#Public.ShareB.ShareA"));
             Assert.IsFalse(simulator1.SelectFolder("#Public.ShareA"));
             Assert.IsTrue(simulator1.SelectFolder("#Public.ShareB"));
             Assert.IsTrue(simulator1.SelectFolder("#Public.ShareB.ShareA"));
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:34,代码来源:IMAP.Folders.cs

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

示例7: TestBeforeLogon

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

              IMAPSimulator oSimulator = new IMAPSimulator();

              string sWelcomeMessage = oSimulator.Connect();

              Assert.IsTrue(oSimulator.ExamineFolder("NonexistantFolder").Contains("NO Authenticate first"));
              Assert.IsFalse(oSimulator.SelectFolder("NonexistantFolder"));
              Assert.IsFalse(oSimulator.Copy(1, "SomeFolder"));
              Assert.IsFalse(oSimulator.CheckFolder("SomeFolder"));
              Assert.IsTrue(oSimulator.Fetch("123 a").Contains("NO Authenticate first"));
              Assert.IsTrue(oSimulator.List().Contains("NO Authenticate first"));
              Assert.IsTrue(oSimulator.LSUB().Contains("NO Authenticate first"));
              Assert.IsTrue(oSimulator.GetMyRights("APA").Contains("NO Authenticate first"));
              Assert.IsFalse(oSimulator.RenameFolder("A", "B"));
              Assert.IsFalse(oSimulator.Status("SomeFolder", "MESSAGES").Contains("A01 OK"));
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:19,代码来源:IMAP.cs

示例8: TestRenameLongFolder

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

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral(oAccount.Address, "test");
             Assert.IsTrue(oSimulator.CreateFolder("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"));
             Assert.IsTrue(oSimulator.CreateFolder("A"));

             Assert.IsFalse(oSimulator.RenameFolder("1", "A.1"));
             Assert.IsTrue(oSimulator.RenameFolder("1.2.3", "A.1"));
             Assert.IsTrue(oSimulator.SelectFolder("A.1.4"));

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

示例9: TestRenameIMAPFolderNotifications

        public void TestRenameIMAPFolderNotifications()
        {
            _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.RenameFolder("Mailbox", "Mailbox2");

              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

示例10: TestRenameAndList5

        public void TestRenameAndList5()
        {
            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.CreateFolder("Root1");
             oSimulator.CreateFolder("Root2.Root3");

             oSimulator.RenameFolder("Root2.Root3", "Root2.Root4");
             oSimulator.RenameFolder("Root1", "Root2.Root4.Root1");

             string result = oSimulator.List();

             Assert.IsFalse(result.Contains(" Root1\r\n"));
             Assert.IsTrue(result.Contains("Root2.Root4.Root1\"\r\n"));

             Assert.IsFalse(oSimulator.SelectFolder("Root1"));
             Assert.IsTrue(oSimulator.SelectFolder("Root2.Root4.Root1"));

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

示例11: TestRename

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

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

             IMAPSimulator oSimulator = new IMAPSimulator();

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

             Assert.IsTrue(oSimulator.CreateFolder("Root1"));
             Assert.IsTrue(oSimulator.CreateFolder("Root1.Sub1"));
             Assert.IsTrue(oSimulator.CreateFolder("Root1.Sub2"));
             Assert.IsTrue(oSimulator.CreateFolder("Root1.Sub3"));
             Assert.IsTrue(oSimulator.SelectFolder("Root1"));
             Assert.IsTrue(oSimulator.SelectFolder("Root1.Sub1"));
             Assert.IsTrue(oSimulator.SelectFolder("Root1.Sub2"));
             Assert.IsTrue(oSimulator.SelectFolder("Root1.Sub3"));
             Assert.IsTrue(oSimulator.RenameFolder("Root1", "Root2"));
             Assert.IsTrue(oSimulator.SelectFolder("Root2"));
             Assert.IsTrue(oSimulator.SelectFolder("Root2.Sub1"));
             Assert.IsTrue(oSimulator.SelectFolder("Root2.Sub2"));
             Assert.IsTrue(oSimulator.SelectFolder("Root2.Sub3"));
             oSimulator.Disconnect();
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:27,代码来源:IMAP.cs

示例12: TestRenamePublicFolderToRootPublicFolder

        public void TestRenamePublicFolderToRootPublicFolder()
        {
            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.ePermissionCreate, true);
             permission.set_Permission(hMailServer.eACLPermission.ePermissionLookup, true);
             permission.set_Permission(hMailServer.eACLPermission.ePermissionDeleteMailbox, true);
             permission.Save();

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

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

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

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

示例13: TestRenameFolderToAndFromPublic

        public void TestRenameFolderToAndFromPublic()
        {
            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.ePermissionCreate, true);
             permission.set_Permission(hMailServer.eACLPermission.ePermissionDeleteMailbox, true);
             permission.set_Permission(hMailServer.eACLPermission.ePermissionLookup, true);
             permission.Save();

             string oldFolderName = "#Public.Share1";
             string newFolderName = "AccountLevelFolder";

             // Test renaming from local folder name to shared folder.
             IMAPSimulator oSimulator1 = new IMAPSimulator();
             oSimulator1.Connect();
             oSimulator1.Logon(account1.Address, "test");
             Assert.IsFalse(oSimulator1.RenameFolder(oldFolderName, newFolderName));
             oSimulator1.Disconnect();

             // Test renaming from local folder name to shared folder.
             oldFolderName = "LocalFolder";
             newFolderName = "#Public.Share1";

             oSimulator1 = new IMAPSimulator();
             oSimulator1.Connect();
             oSimulator1.Logon(account1.Address, "test");
             oSimulator1.CreateFolder(oldFolderName);
             Assert.IsFalse(oSimulator1.RenameFolder(oldFolderName, newFolderName));
             oSimulator1.Disconnect();
        }
开发者ID:nberardi,项目名称:hMailServer,代码行数:39,代码来源:IMAP.ACL.cs


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