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


C# IMAPSimulator.SelectFolder方法代码示例

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


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

示例1: TestIMAPServer

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

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

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

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

示例2: TestNestedOrSearch

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

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

             // Send a message to this account.
             var oSMTP = new SMTPClientSimulator();
             oSMTP.Send("[email protected]", "[email protected]", "Search test", "This is a test of IMAP Search");

             IMAPSimulator.AssertMessageCount(oAccount.Address, "test", "Inbox", 1);

             var oSimulator = new IMAPSimulator();
             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon("[email protected]", "test");
             oSimulator.SelectFolder("INBOX");

             string result =
            oSimulator.SendSingleCommand("A4 SEARCH ALL OR OR SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008");
             Assert.IsTrue(result.StartsWith("* SEARCH 1"), result);

             result = oSimulator.SendSingleCommand("A4 SEARCH ALL OR SMALLER 1 LARGER 10000");
             Assert.IsTrue(result.StartsWith("* SEARCH\r\n"), result);

             result = oSimulator.SendSingleCommand("A4 SEARCH ALL OR OR SMALLER 1 LARGER 10000 SMALLER 10000");
             Assert.IsTrue(result.StartsWith("* SEARCH 1\r\n"), result);
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:27,代码来源:Search.cs

示例3: TestBodyStructureWithNonLatinCharacter

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

             string attachmentName = "本本本.zip";

             string filename = Path.Combine(Path.GetTempPath(), attachmentName);
             File.WriteAllText(filename, "tjena moss");

             var message = new Message();
             message.Charset = "utf-8";
             message.AddRecipient("test", account.Address);
             message.From = "Test";
             message.FromAddress = account.Address;
             message.Body = "hejsan";
             message.Attachments.Add(filename);
             message.Save();

             TestSetup.AssertFolderMessageCount(account.IMAPFolders[0], 1);

             var oSimulator = new IMAPSimulator();
             oSimulator.ConnectAndLogon(account.Address, "test");
             oSimulator.SelectFolder("INBOX");
             string result = oSimulator.Fetch("1 BODYSTRUCTURE");
             oSimulator.Disconnect();

             // utf-8 representation of 本本本.zip:
             Assert.IsTrue(result.Contains("=?utf-8?B?5pys5pys5pys?=.zip"));
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:29,代码来源:Fetch.cs

示例4: TestChangeRecentFlag

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

             Assert.IsTrue(SMTPClientSimulator.StaticSend("[email protected]", oAccount.Address, "Test", "test"));
             POP3Simulator.AssertMessageCount(oAccount.Address, "test", 1);

             var simulator = new IMAPSimulator();
             simulator.ConnectAndLogon(oAccount.Address, "test");
             string result = simulator.ExamineFolder("Inbox");
             Assert.IsTrue(result.Contains("* 1 RECENT"), result);
             simulator.Close();
             simulator.Disconnect();

             simulator = new IMAPSimulator();
             simulator.ConnectAndLogon(oAccount.Address, "test");
             Assert.IsTrue(simulator.SelectFolder("Inbox", out result));
             Assert.IsTrue(result.Contains("* 1 RECENT"), result);
             simulator.Close();
             simulator.Disconnect();

             simulator = new IMAPSimulator();
             simulator.ConnectAndLogon(oAccount.Address, "test");
             result = simulator.ExamineFolder("Inbox");
             Assert.IsTrue(result.Contains("* 0 RECENT"), result);
             simulator.Close();
             simulator.Disconnect();
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:28,代码来源:Examine.cs

示例5: TestDateSortOrder

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

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral("[email protected]", "test");
             Assert.IsTrue(oSimulator.SelectFolder("Inbox"));

             string response =
            oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 22:00:00 +0200\" {37}",
                                                    "Date: Wed, 15 Dec 2010 13:00:00 +0000");
             Assert.IsTrue(response.Contains("* 1 EXISTS"), response);

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 21:00:00 +0200\" {37}",
                                                            "Date: Wed, 15 Dec 2010 14:00:00 +0000");
             Assert.IsTrue(response.Contains("* 2 EXISTS"), response);

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 20:00:00 +0200\" {37}",
                                                            "Date: Wed, 15 Dec 2010 12:00:00 +0000");
             Assert.IsTrue(response.Contains("* 3 EXISTS"), response);

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"23-Feb-2008 01:30:23 +0200\" {37}",
                                                            "Date: Wed, 15 Dec 2010 11:00:00 +0000");
             Assert.IsTrue(response.Contains("* 4 EXISTS"), response);

             string sortDateResponse = oSimulator.SendSingleCommand("A10 SORT (DATE) US-ASCII ALL");

             Assert.IsTrue(sortDateResponse.Contains(" 4 3 1 2"));
             oSimulator.Disconnect();
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:31,代码来源:Sort.cs

示例6: TestChangeSeenFlag

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

             Assert.IsTrue(SMTPClientSimulator.StaticSend("[email protected]", oAccount.Address, "Test", "test"));
             POP3Simulator.AssertMessageCount(oAccount.Address, "test", 1);

             var simulator = new IMAPSimulator();
             simulator.ConnectAndLogon(oAccount.Address, "test");
             simulator.ExamineFolder("Inbox");
             string flags = simulator.GetFlags(1);
             string body = simulator.Fetch("1 RFC822");
             string flagsAfter = simulator.GetFlags(1);
             simulator.Close();
             simulator.Disconnect();

             Assert.AreEqual(flags, flagsAfter);

             var secondSimulator = new IMAPSimulator();
             secondSimulator.ConnectAndLogon(oAccount.Address, "test");
             secondSimulator.SelectFolder("Inbox");
             string secondFlags = secondSimulator.GetFlags(1);
             string secondBody = secondSimulator.Fetch("1 RFC822");
             string secondFlagsAfter = secondSimulator.GetFlags(1);
             secondSimulator.Close();
             secondSimulator.Disconnect();

             Assert.AreNotEqual(secondFlags, secondFlagsAfter);
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:29,代码来源:Examine.cs

示例7: FolderMarkedAsReadOnlyWhenUserHasReadOnlyRights

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

             string selectResult = string.Empty;

             var oSimulator1 = new IMAPSimulator();
             oSimulator1.Connect();
             oSimulator1.LogonWithLiteral(account1.Address, "test");
             oSimulator1.SelectFolder("#Public.Share1", out selectResult);
             oSimulator1.Disconnect();

             Assert.IsTrue(selectResult.Contains("[READ-ONLY]"), selectResult);
             Assert.IsFalse(selectResult.Contains("[READ-WRITE]"), selectResult);
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:28,代码来源:ACL.cs

示例8: TestAddMessage

        public void TestAddMessage()
        {
            Application app = SingletonProvider<TestSetup>.Instance.GetApp();
             Utilities utilities = app.Utilities;

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

             // Create a new folder.
             IMAPFolder folder = account.IMAPFolders.get_ItemByName("INBOX");
             folder.Save();

             for (int i = 0; i < 3; i++)
             {
            hMailServer.Message message = folder.Messages.Add();
            message.set_Flag(eMessageFlag.eMFSeen, true);
            message.Save();

            POP3Simulator.AssertMessageCount(account.Address, "test", ((i + 1)*2) - 1);

            SMTPClientSimulator.StaticSend("[email protected]", account.Address, "Test", "Test");
            POP3Simulator.AssertMessageCount(account.Address, "test", (i + 1)*2);
             }

             POP3Simulator.AssertMessageCount(account.Address, "test", 6);

             var sim = new IMAPSimulator();
             sim.ConnectAndLogon(account.Address, "test");
             sim.SelectFolder("Inbox");

             string response = sim.Fetch("1:6 UID");

             string[] lines = Strings.Split(response, Environment.NewLine, -1, CompareMethod.Text);

             var uids = new List<string>();

             foreach (string line in lines)
             {
            int paraPos = line.IndexOf("(");
            int paraEndPos = line.IndexOf(")");

            if (paraPos < 0 || paraEndPos < 0)
               continue;

            string paraContent = line.Substring(paraPos + 1, paraEndPos - paraPos - 1);

            if (!uids.Contains(paraContent))
               uids.Add(paraContent);
             }

             Assert.AreEqual(6, uids.Count);

             // Make sure the UIDS are sorted properly by creating a copy, sort the copy
             // and then compare to original.
             var copy = new List<string>();
             copy.InsertRange(0, uids);
             copy.Sort();

             Assert.AreEqual(copy, uids);
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:59,代码来源:Basics.cs

示例9: TestCreateFolderWithSlash

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

             const string folderName = "ABC\\123";

             var oSimulator = new IMAPSimulator();
             oSimulator.Connect();
             oSimulator.Logon(oAccount.Address, "test");
             CustomAssert.IsTrue(oSimulator.CreateFolder(folderName));
             CustomAssert.IsTrue(oSimulator.List().Contains(folderName));
             CustomAssert.IsTrue(oSimulator.SelectFolder(folderName));
             oSimulator.Disconnect();
        }
开发者ID:japi,项目名称:hmailserver,代码行数:14,代码来源:Folders.cs

示例10: Test

        public void Test()
        {
            IMAPSimulator sim = new IMAPSimulator();
             sim.ConnectAndLogon("[email protected]", "test");
             sim.SelectFolder("Inbox");

             Stopwatch watch = new Stopwatch();

             watch.Start();
             string result = sim.SendSingleCommand("A282 SORT (SIZE) UTF-8");
             watch.Stop();

             long sortSizeTime = watch.ElapsedMilliseconds;
             watch.Reset();

             watch.Start();
             result = sim.SendSingleCommand("A282 SORT (FROM) UTF-8");
             watch.Stop();

             long sortFromTime = watch.ElapsedMilliseconds;
             watch.Reset();

             watch.Start();
             result = sim.SendSingleCommand("A282 SORT (FROM) UTF-8 1:15");
             watch.Stop();

             long sortFromTimeLimit15 = watch.ElapsedMilliseconds;
             watch.Reset();

             watch.Start();
             result = sim.SendSingleCommand("A282 SORT (DATE) UTF-8");
             watch.Stop();

             long sortDateTime = watch.ElapsedMilliseconds;
             watch.Reset();

             System.Threading.Thread.Sleep(1);
        }
开发者ID:Bill48105,项目名称:hmailserver,代码行数:38,代码来源:IMAPSortPerformance.cs

示例11: TestFetch

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

             SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "SampleBody1");
             IMAPSimulator.AssertMessageCount(account.Address, "test", "Inbox", 1);

             SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "SampleBody2");
             IMAPSimulator.AssertMessageCount(account.Address, "test", "Inbox", 2);

             SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "SampleBody3");
             IMAPSimulator.AssertMessageCount(account.Address, "test", "Inbox", 3);

             var sim = new IMAPSimulator();
             sim.ConnectAndLogon(account.Address, "test");
             sim.SelectFolder("INBOX");
             string result = sim.Fetch("1 BODY[1]");
             Assert.IsTrue(result.Contains("SampleBody1"), result);
             result = sim.Fetch("2 BODY[1]");
             Assert.IsTrue(result.Contains("SampleBody2"), result);
             result = sim.Fetch("3 BODY[1]");
             Assert.IsTrue(result.Contains("SampleBody3"), result);
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:23,代码来源:Fetch.cs

示例12: TestAppendFolderNameInOctet

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

             var oSimulator = new IMAPSimulator();

             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:jrallo,项目名称:hMailServer,代码行数:23,代码来源:Basics.cs

示例13: TestDateSortOrderNonexistantDate

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

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral("[email protected]", "test");
             Assert.IsTrue(oSimulator.SelectFolder("Inbox"));

             string response = oSimulator.SendSingleCommandWithLiteral(
            "A04 APPEND INBOX \"22-Feb-2008 22:00:00 +0200\" {4}", "ABCD");
             Assert.IsTrue(response.Contains("* 1 EXISTS"), response);

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 21:00:00 +0200\" {4}",
                                                            "ABCD");
             Assert.IsTrue(response.Contains("* 2 EXISTS"), response);

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 20:00:00 +0200\" {4}",
                                                            "ABCD");
             Assert.IsTrue(response.Contains("* 3 EXISTS"), response);

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"23-Feb-2008 01:30:23 +0200\" {4}",
                                                            "ABCD");
             Assert.IsTrue(response.Contains("* 4 EXISTS"), response);

             /*
              * RFC 5256 "2.2. Sent Date" chapter. If the sent date cannot be determined (a Date: header is missing or cannot be parsed),
              * the INTERNALDATE for that message is used as the sent date.
              */

             string sortDateResponse = oSimulator.SendSingleCommand("A10 SORT (DATE) US-ASCII ALL");
             string sortArivalDateResponse = oSimulator.SendSingleCommand("A10 SORT (ARRIVAL) US-ASCII ALL");

             Assert.IsTrue(sortArivalDateResponse.Contains(" 3 2 1 4"));
             Assert.AreEqual(sortDateResponse, sortArivalDateResponse);
             oSimulator.Disconnect();
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:37,代码来源:Sort.cs

示例14: TestIdle

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

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

             var oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon(account.Address, "test");
             Assert.IsTrue(oSimulator.SelectFolder("INBOX"));

             oSimulator.StartIdle();

             if (oSimulator.GetPendingDataExists())
            throw new Exception("Unexpected data exists");

             // Send a message to this account.
             var oSMTP = new SMTPClientSimulator();
             oSMTP.Send(account.Address, account.Address, "IDLE Test", "This is a test of IDLE");

             string data;
             Assert.IsTrue(oSimulator.EndIdle(false, out data));
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:24,代码来源:Basics.cs

示例15: TestFolderUpdateNotification

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

             SMTPClientSimulator.StaticSend(account.Address, account.Address, "TestSubject", "TestBody");

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

             var simulator1 = new IMAPSimulator();
             var simulator2 = new IMAPSimulator();

             simulator1.ConnectAndLogon(account.Address, "test");
             simulator2.ConnectAndLogon(account.Address, "test");

             simulator1.SelectFolder("Inbox");
             simulator2.SelectFolder("Inbox");

             string result = simulator2.NOOP() + simulator2.NOOP();
             Assert.IsFalse(result.Contains("Deleted"));
             Assert.IsFalse(result.Contains("Seen"));

             simulator1.SetDeletedFlag(1);
             simulator1.SetSeenFlag(1);

             result = simulator2.NOOP() + simulator2.NOOP();
             Assert.IsTrue(result.Contains("Deleted"));
             Assert.IsTrue(result.Contains("Seen"));

             simulator1.Disconnect();
             simulator2.Disconnect();
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:31,代码来源:Basics.cs


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