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


C# IMAPClientSimulator.SendSingleCommand方法代码示例

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


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

示例1: 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");

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

             var oSimulator = new IMAPClientSimulator();
             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");
             CustomAssert.IsTrue(result.StartsWith("* SEARCH 1"), result);

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

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

示例2: TestDateSortOrder

        public void TestDateSortOrder()
        {
            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 response =
            oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 22:00:00 +0200\" {37}",
                                                    "Date: Wed, 15 Dec 2010 13:00:00 +0000");
             CustomAssert.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");
             CustomAssert.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");
             CustomAssert.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");
             CustomAssert.IsTrue(response.Contains("* 4 EXISTS"), response);

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

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

示例3: IfStlsRequiredLogonShouldSucceedIfStls

        public void IfStlsRequiredLogonShouldSucceedIfStls()
        {
            var imapSimulator = new IMAPClientSimulator(false, 14303);
             imapSimulator.Connect();
             imapSimulator.SendSingleCommand("A01 STARTTLS");
             imapSimulator.Handshake();

             // command is sent over TLS.
             imapSimulator.GetCapabilities();

             CustomAssert.IsTrue(imapSimulator.Logon(_account.Address, "test"));
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:12,代码来源:ImapServerTests.cs

示例4: TestSearchUID

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

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

             // Send a message to this account.
             var oSMTP = new SMTPClientSimulator();
             for (int i = 0; i < 3; i++)
            oSMTP.Send("[email protected]", "[email protected]", "Test1", "This is a test of IMAP Search");

             IMAPClientSimulator.AssertMessageCount("[email protected]", "test", "INBOX", 3);

             // There should be 3 UID's, 1,2,3 or similar. No skips in the middle fo them.
             var oSimulator = new IMAPClientSimulator();
             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon("[email protected]", "test");
             CustomAssert.IsTrue(oSimulator.SelectFolder("INBOX"));

             string result = oSimulator.SendSingleCommand("* UID SEARCH UID 1:*");

             // Potentially, the response is multiline. (UID RESPONSE and an OK line). We only want the first line...
             result = result.Substring(0, result.IndexOf("\r\n"));

             string[] tokens = Strings.Split(result, " ", -1, CompareMethod.Text);

             var uids = new List<int>();
             foreach (string token in tokens)
             {
            int temp;
            if (Int32.TryParse(token, out temp))
            {
               uids.Add(temp);
            }
             }

             CustomAssert.AreEqual(3, uids.Count, result);

             CustomAssert.AreEqual(1, uids[0]);
             CustomAssert.AreEqual(2, uids[1]);
             CustomAssert.AreEqual(3, uids[2]);
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:42,代码来源:Search.cs

示例5: TestSearchRange

        public void TestSearchRange()
        {
            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();
             for (int i = 0; i < 5; i++)
            oSMTP.Send("[email protected]", "[email protected]", "Test1", "This is a test of IMAP Search");

             IMAPClientSimulator.AssertMessageCount("[email protected]", "test", "INBOX", 5);

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

             string result = oSimulator.SendSingleCommand("a01 search 2:4");
             CustomAssert.IsTrue(result.StartsWith("* SEARCH 2 3 4"));

             result = oSimulator.SendSingleCommand("a01 search 3,2");
             CustomAssert.IsTrue(result.StartsWith("* SEARCH 2 3"));

             result = oSimulator.SendSingleCommand("a01 search 3:*");
             CustomAssert.IsTrue(result.StartsWith("* SEARCH 3 4 5"));

             result = oSimulator.SendSingleCommand("a01 search 3,1,3");
             CustomAssert.IsTrue(result.StartsWith("* SEARCH 1 3"));

             result = oSimulator.SendSingleCommand("a01 search 1:*");
             CustomAssert.IsTrue(result.StartsWith("* SEARCH 1 2 3 4 5"));
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:33,代码来源:Search.cs

示例6: TestSearchInvalidCharset

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

             SMTPClientSimulator.StaticSend(account.Address, account.Address, "MySubject", "MyBody");

             POP3ClientSimulator.AssertMessageCount(account.Address, "test", 1);

             var oSimulator = new IMAPClientSimulator();
             CustomAssert.IsTrue(oSimulator.ConnectAndLogon(account.Address, "test"));
             CustomAssert.IsTrue(oSimulator.SelectFolder("INBOX"));

             string result = oSimulator.SendSingleCommand("A01 SEARCH CHARSET NONEXISTANT ALL SUBJECT MySubject");
             CustomAssert.AreEqual("A01 NO [BADCHARSET]\r\n", result);
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:15,代码来源:Search.cs

示例7: StlsCommandShouldSwithToTls

        public void StlsCommandShouldSwithToTls()
        {
            var imapSimulator = new IMAPClientSimulator(false, 14302);
             imapSimulator.Connect();
             var data = imapSimulator.GetCapabilities();
             imapSimulator.SendSingleCommand("A01 STARTTLS");
             imapSimulator.Handshake();

             // command is sent over TLS.
             imapSimulator.GetCapabilities();

             imapSimulator.Logon(_account.Address, "test");
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:13,代码来源:ImapServerTests.cs

示例8: TestDateSortOrderNonexistantDate

        public void TestDateSortOrderNonexistantDate()
        {
            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 response = oSimulator.SendSingleCommandWithLiteral(
            "A04 APPEND INBOX \"22-Feb-2008 22:00:00 +0200\" {4}", "ABCD");
             CustomAssert.IsTrue(response.Contains("* 1 EXISTS"), response);

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

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

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"23-Feb-2008 01:30:23 +0200\" {4}",
                                                            "ABCD");
             CustomAssert.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");

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

示例9: TestSearchSpecficUID

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

             // Send a message to this account.
             var oSMTP = new SMTPClientSimulator();
             for (int i = 0; i < 5; i++)
            oSMTP.Send("[email protected]", "[email protected]", "Test1", "This is a test of IMAP Search");

             IMAPClientSimulator.AssertMessageCount("[email protected]", "test", "INBOX", 5);

             Messages messages = oAccount.IMAPFolders.get_ItemByName("Inbox").Messages;

             int second = messages[1].UID;
             int third = messages[2].UID;
             int fourth = messages[3].UID;

             var oSimulator = new IMAPClientSimulator();
             oSimulator.Connect();
             oSimulator.Logon("[email protected]", "test");
             CustomAssert.IsTrue(oSimulator.SelectFolder("INBOX"));

             string result = oSimulator.SendSingleCommand(string.Format("a01 SORT (REVERSE DATE) UTF-8 ALL UID {0},{1}", second, third));
             AssertSortResultContains(result, 2, 3);

             result = oSimulator.SendSingleCommand(string.Format("a01 SORT (DATE) UTF-8 ALL UID {0},{1}", third, second));
             AssertSortResultContains(result, 2, 3);

             result = oSimulator.SendSingleCommand(string.Format("a01 SORT (DATE) UTF-8 ALL UID {0}:{1}", second, fourth));
             AssertSortResultContains(result, 2, 3, 4);

             result = oSimulator.SendSingleCommand(string.Format("a01 SORT (DATE) UTF-8 ALL UID {0}:*", second));
             AssertSortResultContains(result, 2, 3, 4, 5);
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:34,代码来源:Sort.cs

示例10: TestAuthenticate

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

             var oSimulator = new IMAPClientSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             string result = oSimulator.SendSingleCommand("A01 AUTHENTICATE");
             CustomAssert.IsTrue(result.Contains("NO Unsupported authentication mechanism."));
             oSimulator.Disconnect();
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:11,代码来源:Basics.cs

示例11: 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();
             CustomAssert.IsTrue(sim.ConnectAndLogon(account.Address, "test"));
             CustomAssert.IsTrue(sim.SelectFolder("Inbox"));
             CustomAssert.IsTrue(sim.CreateFolder("Dummy"));
             CustomAssert.IsTrue(sim.Copy(1, "Dummy"));

             string result = sim.SendSingleCommand("a01 select Dummy");
             CustomAssert.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.
             CustomAssert.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");
             CustomAssert.IsTrue(searchResponse.Contains("* SEARCH\r\n"), searchResponse);

             // Close the messages to mark them as no longer recent.
             CustomAssert.IsTrue(sim.Close());

             result = sim.SendSingleCommand("a01 select Dummy");
             CustomAssert.IsTrue(result.Contains("* 1 EXISTS\r\n* 0 RECENT"), result);
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:35,代码来源:Basics.cs

示例12: TestRecentRemovedOnMailboxClose

        public void TestRecentRemovedOnMailboxClose()
        {
            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();
             CustomAssert.IsTrue(sim.ConnectAndLogon(account.Address, "test"));
             CustomAssert.IsTrue(sim.SelectFolder("Inbox"));
             CustomAssert.IsTrue(sim.CreateFolder("Dummy"));
             CustomAssert.IsTrue(sim.Copy(1, "Dummy"));
             string result = sim.SendSingleCommand("a01 select Dummy");
             CustomAssert.IsTrue(result.Contains("* 1 EXISTS\r\n* 1 RECENT"), result);
             CustomAssert.IsTrue(sim.Logout());

             sim = new IMAPClientSimulator();
             CustomAssert.IsTrue(sim.ConnectAndLogon(account.Address, "test"));
             result = sim.SendSingleCommand("a01 select Dummy");
             CustomAssert.IsFalse(result.Contains("* 1 EXISTS\r\n* 1 RECENT"), result);
             CustomAssert.IsTrue(sim.Logout());
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:22,代码来源:Basics.cs


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