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


C# ImapClientSimulator.RenameFolder方法代码示例

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


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

示例1: TestRenameFolderToAndFromPublic

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

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

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

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

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

示例2: TestBeforeLogon

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

             var oSimulator = new ImapClientSimulator();

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

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

示例4: TestRenameAndList5

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

             var oSimulator = new ImapClientSimulator();

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

示例5: TestRenameIMAPFolderNotifications

        public void TestRenameIMAPFolderNotifications()
        {
            _settings.IMAPIdleEnabled = true;

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

             var imapClientSimulator = new ImapClientSimulator();
             var oSimulator2 = new ImapClientSimulator();
             imapClientSimulator.ConnectAndLogon(oAccount.Address, "test");
             oSimulator2.ConnectAndLogon(oAccount.Address, "test");

             imapClientSimulator.SelectFolder("Inbox");
             oSimulator2.CreateFolder("Mailbox");
             oSimulator2.RenameFolder("Mailbox", "Mailbox2");

             SmtpClientSimulator.StaticSend("[email protected]", oAccount.Address, "Test", "test");

             Pop3ClientSimulator.AssertMessageCount(oAccount.Address, "test", 1);

             string noopResponse = imapClientSimulator.NOOP() + imapClientSimulator.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:baa-archieve,项目名称:hmailserver,代码行数:25,代码来源:Basics.cs

示例6: TestTryCreateInvalidStructure

        public void TestTryCreateInvalidStructure()
        {
            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"));
             Assert.IsTrue(oSimulator.CreateFolder("1.2.3.4"));

             // Should fail because name taken.
             Assert.IsFalse(oSimulator.RenameFolder("1.2.3.4", "1.2.3"));
             Assert.IsFalse(oSimulator.RenameFolder("1.2.3.4", "1.2"));
             Assert.IsFalse(oSimulator.RenameFolder("1.2.3.4", "1"));

             // Should fail because invalid destination name.
             Assert.IsFalse(oSimulator.RenameFolder("1.2.3.4", ""));

             // Should fail because destination name taken.
             Assert.IsFalse(oSimulator.RenameFolder("1.2.3", "1.2.3.4"));
             Assert.IsFalse(oSimulator.RenameFolder("1.2", "1.2.3.4"));
             Assert.IsFalse(oSimulator.RenameFolder("1", "1.2.3.4"));

             Assert.IsFalse(oSimulator.RenameFolder("1.2.3", "1.2"));
             Assert.IsFalse(oSimulator.RenameFolder("1.2.3", "1"));

             Assert.IsTrue(oSimulator.RenameFolder("1.2.3", "A"));

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

示例7: TestRename

        public void TestRename()
        {
            Application application = SingletonProvider<TestSetup>.Instance.GetApp();
             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("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:baa-archieve,项目名称:hmailserver,代码行数:25,代码来源:Basics.cs

示例8: TestRenameToParallelFolder

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

             var oSimulator = new ImapClientSimulator();

             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:SpivEgin,项目名称:hmailserver,代码行数:17,代码来源:Folders.cs

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

示例10: TestRenameToAndFromINBOX

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

             var oSimulator = new ImapClientSimulator();

             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:SpivEgin,项目名称:hmailserver,代码行数:14,代码来源:Folders.cs

示例11: TestRenameSubFolderToMatchingName

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

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

示例12: TestRenameRootPublicFolder

        public void TestRenameRootPublicFolder()
        {
            IMAPFolders folders = _application.Settings.PublicFolders;
             IMAPFolder folder = folders.Add("ShareA");
             folder.Save();

             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.ePermissionDeleteMailbox, true);
             permission.Save();

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

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

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

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

示例13: TestRenameLongFolder

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

             var oSimulator = new ImapClientSimulator();

             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:SpivEgin,项目名称:hmailserver,代码行数:17,代码来源:Folders.cs

示例14: TestHierarchyDelimiterRename

        public void TestHierarchyDelimiterRename()
        {
            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";
             string newFolderName = "Apa/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("\"" + 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:SpivEgin,项目名称:hmailserver,代码行数:24,代码来源:HierarchyDelimiter.cs


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