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


C# IMAPClientSimulator.Search方法代码示例

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


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

示例1: TestAppendDeletedMessage

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

             var oSimulator = new IMAPClientSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon("[email protected]", "test");
             oSimulator.SendSingleCommandWithLiteral("A01 APPEND INBOX (\\Deleted) {4}", "ABCD");
             CustomAssert.AreEqual(1, oSimulator.GetMessageCount("INBOX"));

             CustomAssert.AreEqual("1", oSimulator.Search("DELETED"));

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

示例2: TestSearch

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

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

             // Send a message to this account.
             var oSMTP = new SMTPClientSimulator();
             oSMTP.Send(oAccount.Address, oAccount.Address, "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(oAccount.Address, "test");
             CustomAssert.IsTrue(oSimulator.SelectFolder("INBOX"));

             oSimulator.SetFlagOnFirstMessage(true, "\\ANSWERED");
             if (oSimulator.Search("ANSWERED") != "1")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(false, "\\ANSWERED");
             if (oSimulator.Search("ANSWERED") != "")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(true, "\\DELETED");
             if (oSimulator.Search("DELETED") != "1")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(false, "\\DELETED");
             if (oSimulator.Search("DELETED") != "")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(true, "\\DRAFT");
             if (oSimulator.Search("DRAFT") != "1")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(false, "\\DRAFT");
             if (oSimulator.Search("DRAFT") != "")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(true, "\\FLAGGED");
             if (oSimulator.Search("FLAGGED  ") != "1")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(false, "\\FLAGGED");
             if (oSimulator.Search("FLAGGED") != "")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(true, "\\SEEN");
             if (oSimulator.Search("SEEN") != "1")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(false, "\\SEEN");
             if (oSimulator.Search("SEEN") != "")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(true, "\\ANSWERED");
             if (oSimulator.Search("UNANSWERED") != "")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(false, "\\ANSWERED");
             if (oSimulator.Search("UNANSWERED") != "1")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(true, "\\DELETED");
             if (oSimulator.Search("UNDELETED") != "")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(false, "\\DELETED");
             if (oSimulator.Search("UNDELETED") != "1")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(true, "\\DRAFT");
             if (oSimulator.Search("UNDRAFT") != "")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(false, "\\DRAFT");
             if (oSimulator.Search("UNDRAFT") != "1")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(true, "\\FLAGGED");
             if (oSimulator.Search("UNFLAGGED") != "")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(false, "\\FLAGGED");
             if (oSimulator.Search("UNFLAGGED") != "1")
            throw new Exception("ERROR - Search or flag failed");

             // SEARCH using LARGER & SMALLER
             if (oSimulator.Search("SMALLER 10") != "")
            throw new Exception("ERROR - Search or flag failed");

             if (oSimulator.Search("SMALLER 10000") != "1")
            throw new Exception("ERROR - Search or flag failed");

             if (oSimulator.Search("LARGER 10") != "1")
            throw new Exception("ERROR - Search or flag failed");

//.........这里部分代码省略.........
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:101,代码来源:Search.cs

示例3: TestSearchUTF8TEXT

        public void TestSearchUTF8TEXT()
        {
            Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
             string body = TestSetup.GetResource("Messages.MessageContainingGreekSubject.txt");
             SMTPClientSimulator.StaticSendRaw(account.Address, account.Address, body);

             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.Search("CHARSET UTF-8 ALL TEXT GRΣΣK");
             CustomAssert.AreEqual("1", result);

             result = oSimulator.Search("CHARSET UTF-8 ALL TEXT 標準語");
             CustomAssert.AreEqual("1", result);

             result = oSimulator.Search("CHARSET UTF-8 ALL TEXT GRΣΣK標準語");
             CustomAssert.AreEqual("1", result);

             result = oSimulator.Search("CHARSET UTF-8 ALL TEXT GRΣΣKWHAT標準語");
             CustomAssert.AreEqual("", result);
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:24,代码来源:Search.cs

示例4: TestSearchUSASCII

        public void TestSearchUSASCII()
        {
            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.Search("CHARSET US-ASCII ALL SUBJECT MySubject");
             CustomAssert.AreEqual("1", result);

             result = oSimulator.Search("CHARSET US-ASCII ALL SUBJECT MySubjact");
             CustomAssert.AreEqual("", result);
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:18,代码来源:Search.cs

示例5: TestSearchORWithParenthesisSubjectNested

        public void TestSearchORWithParenthesisSubjectNested()
        {
            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]", "Test1", "This is a test of IMAP Search");
             IMAPClientSimulator.AssertMessageCount("[email protected]", "test", "INBOX", 1);
             oSMTP.Send("[email protected]", "[email protected]", "Test2", "This is a test of IMAP Search");
             IMAPClientSimulator.AssertMessageCount("[email protected]", "test", "INBOX", 2);

             var oSimulator = new IMAPClientSimulator();

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

             if (oSimulator.Search("ALL (OR (HEADER SUBJECT \"Test1\") (HEADER SUBJECT \"Test2\"))") != "1 2")
             {
            throw new Exception("ERROR - Search or flag failed");
             }
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:24,代码来源:Search.cs

示例6: TestSearchOR

        public void TestSearchOR()
        {
            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("[email protected]", "test", "INBOX", 1);

             var oSimulator = new IMAPClientSimulator();

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

             CustomAssert.AreEqual("1", oSimulator.Search("OR SINCE 28-May-2001 ON 28-May-2001 ALL"));
             CustomAssert.IsNullOrEmpty(oSimulator.Search("OR SINCE 28-May-2020 ON 28-May-2012 ALL"));

             string formattedToday = DateTime.Now.ToString("dd-MMM-yyyy", CultureInfo.InvariantCulture).ToUpper();
             CustomAssert.AreEqual("1", oSimulator.Search("OR SINCE 28-May-2017 ON " + formattedToday + " ALL"));

             string formatted2001 = new DateTime(2001, 01, 01).ToString("dd-MMM-yyyy").ToUpper();
             CustomAssert.AreEqual("1", oSimulator.Search("OR SINCE 28-May-2008 ON " + formatted2001 + " ALL"));
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:24,代码来源:Search.cs

示例7: TestSearchON

        public void TestSearchON()
        {
            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("[email protected]", "test", "INBOX", 1);

             var oSimulator = new IMAPClientSimulator();

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

             string formattedTomorrow =
            (DateTime.Now + new TimeSpan(1, 0, 0, 0)).ToString("dd-MMM-yyyy", CultureInfo.InvariantCulture).ToUpper();
             string formattedToday = DateTime.Now.ToString("dd-MMM-yyyy", CultureInfo.InvariantCulture).ToUpper();

             if (oSimulator.Search("ON " + formattedTomorrow) != "")
             {
            throw new Exception("ERROR - Search or flag failed");
             }

             if (oSimulator.Search("ON " + formattedToday) != "1")
             {
            throw new Exception("ERROR - Search or flag failed");
             }
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:31,代码来源:Search.cs

示例8: TestSearchLargeBody

        public void TestSearchLargeBody()
        {
            Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
             var body = new StringBuilder();
             body.AppendLine("From: [email protected]");
             body.AppendLine("Subject: Test");
             body.AppendLine();
             for (int i = 0; i < 20000; i++) // One megabye body.
            body.AppendLine("12345678901234567890123456789012345678901234567890");
             body.AppendLine("TestString");
             body.AppendLine();

             SMTPClientSimulator.StaticSendRaw(account.Address, account.Address, body.ToString());

             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.Search("CHARSET UTF-8 ALL TEXT InvalidText");
             CustomAssert.AreEqual("", result);

             result = oSimulator.Search("CHARSET UTF-8 ALL TEXT TestStringA");
             CustomAssert.AreEqual("", result);

             result = oSimulator.Search("CHARSET UTF-8 ALL TEXT TestString");
             CustomAssert.AreEqual("1", result);

             result = oSimulator.Search("CHARSET UTF-8 ALL TEXT TestStr");
             CustomAssert.AreEqual("1", result);

             result = oSimulator.Search("UNDELETED BODY \"TestString\"");
             CustomAssert.AreEqual("1", result);

             oSimulator.Close();
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:36,代码来源:Search.cs


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