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


C# IMAPClientSimulator.Fetch方法代码示例

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


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

示例1: 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 IMAPClientSimulator();
             oSimulator.ConnectAndLogon(account.Address, "test");
             oSimulator.SelectFolder("INBOX");
             string result = oSimulator.Fetch("1 BODYSTRUCTURE");
             oSimulator.Disconnect();

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

示例2: TestChangeSeenFlag

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

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

             var simulator = new IMAPClientSimulator();
             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();

             CustomAssert.AreEqual(flags, flagsAfter);

             var secondSimulator = new IMAPClientSimulator();
             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();

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

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

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

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

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

             var sim = new IMAPClientSimulator();
             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);
             }

             CustomAssert.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();

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

示例4: TestParseMultipartNoBody

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

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

             var imapSim = new IMAPClientSimulator("[email protected]", "test", "INBOX");
             string result = imapSim.Fetch("1 (BODY.PEEK[HEADER] BODY.PEEK[TEXT])");

             imapSim.Logout();
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:13,代码来源:MessageParsing.cs

示例5: TestFetch

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

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

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

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

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

示例6: TestFetchCharsetInQuotesWithoutSpace

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

             SMTPClientSimulator.StaticSendRaw(account.Address, account.Address,
                                           "From: [email protected]\r\n" +
                                           "Content-Type: text/plain; charset =\"iso-8859-1\"\r\n" +
                                           "\r\n" +
                                           "Test\r\n");

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

             var sim = new IMAPClientSimulator(account.Address, "test", "Inbox");
             string result = sim.Fetch("1 BODYSTRUCTURE");
             sim.Disconnect();

             CustomAssert.IsTrue(result.Contains("(\"CHARSET\" \"iso-8859-1\")"), result);
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:18,代码来源:Parameters.cs

示例7: TestBodyStructureWithNonLatinCharacterTest3

        public void TestBodyStructureWithNonLatinCharacterTest3()
        {
            string @messageText =
            "To: [email protected]\r\n" +
            "Content-Type: multipart/mixed;\r\n" +
            " boundary=\"------------000008080307000003010005\"\r\n" +
            "\r\n" +
            "This is a multi-part message in MIME format.\r\n" +
            "--------------000008080307000003010005\r\n" +
            "Content-Type: text/plain; charset=ISO-8859-1; format=flowed\r\n" +
            "Content-Transfer-Encoding: 7bit\r\n" +
            "\r\n" +
            "Test\r\n" +
            "\r\n" +
            "--------------000008080307000003010005\r\n" +
            "Content-Type: image/png;\r\n" +
            " name=\"=?ISO-8859-1?Q?=F6=50=C4=C9=CD=C1=D6=60=F6=F6=E4=27=2E=70=6E=67?=\"\r\n" +
            "Content-Transfer-Encoding: base64\r\n" +
            "Content-Disposition: inline;\r\n" +
            " filename*=ISO-8859-1''%F6%50%C4%C9%CD%C1%D6%60%F6%F6%E4%27%2E%70%6E%67\r\n" +
            "\r\n" +
            "iVBORw0KGgoAAAANSUhEUgAAAqgAAAH4CAIAAAAJvIhhAAAAAXNSR0IArs4c6QAAAARnQU1B\r\n" +
            "AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA\r\n" +
            "--------------000008080307000003010005--\r\n";

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

             CustomAssert.IsTrue(SMTPClientSimulator.StaticSendRaw(account.Address, account.Address, messageText));

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

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

             CustomAssert.IsTrue(
            result.Contains("\"FILENAME\" \"=?ISO-8859-1?Q?=F6=50=C4=C9=CD=C1=D6=60=F6=F6=E4=27=2E=70=6E=67?=\""));
             CustomAssert.IsTrue(
            result.Contains("\"NAME\" \"=?ISO-8859-1?Q?=F6=50=C4=C9=CD=C1=D6=60=F6=F6=E4=27=2E=70=6E=67?=\""));
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:42,代码来源:Basics.cs

示例8: TestBodyStructureWithNonLatinCharacterSingleLineWithSpace

        public void TestBodyStructureWithNonLatinCharacterSingleLineWithSpace()
        {
            string @messageText =
            "Return-Path: [email protected]\r\n" +
            "Delivered-To: [email protected]\r\n" +
            "Received: from www.hmailserver.com ([127.0.0.1])\r\n" +
            "	by mail.hmailserver.com\r\n" +
            "	; Tue, 16 Jun 2009 21:39:18 +0200\r\n" +
            "MIME-Version: 1.0\r\n" +
            "Date: Tue, 16 Jun 2009 21:39:18 +0200\r\n" +
            "From: <[email protected]>\r\n" +
            "To: <[email protected]>\r\n" +
            "Subject: sdafsda\r\n" +
            "Message-ID: <[email protected]>\r\n" +
            "X-Sender: [email protected]\r\n" +
            "User-Agent: RoundCube Webmail/0.2.2\r\n" +
            "Content-Type: multipart/mixed;\r\n" +
            "	boundary=\"=_b63968892a76b1a5be17f4d37b085f54\"\r\n" +
            "\r\n" +
            "--=_b63968892a76b1a5be17f4d37b085f54\r\n" +
            "Content-Transfer-Encoding: 8bit\r\n" +
            "Content-Type: text/plain; charset=\"UTF-8\"\r\n" +
            "\r\n" +
            "--=_b63968892a76b1a5be17f4d37b085f54\r\n" +
            "Content-Transfer-Encoding: base64\r\n" +
            "Content-Type: application/x-zip; charset=\"UTF-8\";\r\n" +
            " name*=\"UTF-8''m%C3%A4%C3%B6 m%C3%A4%C3%B6.zip\"; \r\n" +
            "Content-Disposition: attachment;\r\n" +
            " filename*=\"UTF-8''m%C3%A4%C3%B6 m%C3%A4%C3%B6.zip\"; \r\n" +
            "\r\n" +
            "iVBORw0KGgoAAAANSUhEUgAAAqgAAAH4CAIAAAAJvIhhAAAAAXNSR0IArs4c6QAAAARnQU1BAACx\r\n" +
            "jwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAIr1JREFU\r\n" +
            "eF7t29GSYzluBND1/3/0ejb6wY6emK2WrpQEkaefdQvAAcn02OH/+fe///0v/wgQIECAAIESgb+C\r\n" +
            "3z8CBAgQIECgROBfJXMakwABAgQIEPjP/5qfAgECBAgQINAjIPh7dm1SAgQIECDgv/idAQIECBAg\r\n" +
            "--=_b63968892a76b1a5be17f4d37b085f54--\r\n" +
            "";

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

             CustomAssert.IsTrue(SMTPClientSimulator.StaticSendRaw(account.Address, account.Address, messageText));

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

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

             CustomAssert.IsFalse(result.Contains("''"), result);
             CustomAssert.IsTrue(result.Contains("\"FILENAME\" \"=?UTF-8?Q?m=C3=A4=C3=B6 m=C3=A4=C3=B6.zip?=\""), result);
             CustomAssert.IsTrue(result.Contains("\"NAME\" \"=?UTF-8?Q?m=C3=A4=C3=B6 m=C3=A4=C3=B6.zip?=\""), result);
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:53,代码来源:Basics.cs

示例9: TestBodyStructureWithNonLatinCharacterSingleLineEncoded

        public void TestBodyStructureWithNonLatinCharacterSingleLineEncoded()
        {
            string @messageText =
            "Message-ID: <[email protected]*******.**>\r\n" +
            "Date: Fri, 29 May 2009 11:53:03 +0200\r\n" +
            "Subject: attachment's name test\r\n" +
            "From: [email protected]\r\n" +
            "To: [email protected]\r\n" +
            "User-Agent: SquirrelMail/1.4.19\r\n" +
            "MIME-Version: 1.0\r\n" +
            "Content-Type: multipart/mixed;boundary=\"----=_20090529115303_60479\"\r\n" +
            "X-Priority: 3 (Normal)\r\n" +
            "Importance: Normal\r\n" +
            "\r\n" +
            "------=_20090529115303_60479\r\n" +
            "Content-Type: text/plain; charset=\"iso-8859-2\"\r\n" +
            "Content-Transfer-Encoding: 8bit\r\n" +
            "\r\n" +
            "test.±æê³ñ󶼿.txt\r\n" +
            "------=_20090529115303_60479\r\n" +
            "Content-Type: text/plain; name=\r\n" +
            "    =?iso-8859-2?Q?test.=B1=E6=EA=B3=F1=F3=B6=BC=BF.txt?=\r\n" +
            "Content-Transfer-Encoding: 8bit\r\n" +
            "Content-Disposition: attachment; filename=\"\r\n" +
            "    =?iso-8859-2?Q?test.=B1=E6=EA=B3=F1=F3=B6=BC=BF.txt?=\"\r\n" +
            "\r\n" +
            "1234\r\n" +
            "------=_20090529115303_60479--\r\n";

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

             CustomAssert.IsTrue(SMTPClientSimulator.StaticSendRaw(account.Address, account.Address, messageText));

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

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

             CustomAssert.IsTrue(result.Contains("(\"NAME\" \"=?iso-8859-2?Q?test.=B1=E6=EA=B3=F1=F3=B6=BC=BF.txt?=\")"));
             CustomAssert.IsTrue(result.Contains("(\"FILENAME\" \"=?iso-8859-2?Q?test.=B1=E6=EA=B3=F1=F3=B6=BC=BF.txt?=\")"));
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:44,代码来源:Basics.cs

示例10: TestFetchHeaderFieldsNot

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

             string message = "From: Someone <[email protected]>" + Environment.NewLine +
                          "To: Someoen <[email protected]>" + Environment.NewLine +
                          "Date: Wed, 22 Apr 2009 11:05:09 \"GMT\"" + Environment.NewLine +
                          "Subject: Something" + Environment.NewLine +
                          Environment.NewLine +
                          "Hello" + Environment.NewLine;

             var smtpSimulator = new SMTPClientSimulator();
             CustomAssert.IsTrue(smtpSimulator.SendRaw(account.Address, account.Address, message));

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

             var oSimulator = new IMAPClientSimulator();
             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon(account.Address, "test");
             oSimulator.SelectFolder("INBOX");
             string result = oSimulator.Fetch("1 BODY.PEEK[HEADER.FIELDS.NOT (Subject From)]");
             oSimulator.Disconnect();

             CustomAssert.IsTrue(result.Contains("Received:"), result);
             CustomAssert.IsFalse(result.Contains("Subject:"), result);
             CustomAssert.IsFalse(result.Contains("From:"), result);
             // The feedback should end with an empty header line.
             CustomAssert.IsTrue(result.Contains("\r\n\r\n)"), result);
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:29,代码来源:Fetch.cs

示例11: TestBeforeLogon

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

             var oSimulator = new IMAPClientSimulator();

             string sWelcomeMessage = oSimulator.Connect();

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

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

示例13: TestFetchBody

        public void TestFetchBody()
        {
            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 IMAPClientSimulator();
             oSimulator.ConnectAndLogon(account.Address, "test");
             oSimulator.SelectFolder("INBOX");
             string bodyStructureResponse = oSimulator.Fetch("1 BODYSTRUCTURE");
             string bodyResponse = oSimulator.Fetch("1 BODY");
             oSimulator.Disconnect();

             CustomAssert.IsTrue(bodyStructureResponse.Contains("BOUNDARY"));
             CustomAssert.IsFalse(bodyResponse.Contains("BOUNDARY"));
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:30,代码来源:Fetch.cs

示例14: TestFetchInvalid

        public void TestFetchInvalid()
        {
            Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
             SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "SampleBody1");
             SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "SampleBody2");
             SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "SampleBody3");

             IMAPClientSimulator.AssertMessageCount(account.Address, "test", "Inbox", 3);

             var sim = new IMAPClientSimulator();
             sim.ConnectAndLogon(account.Address, "test");
             sim.SelectFolder("INBOX");
             string result = sim.Fetch("0 BODY[1]");
             CustomAssert.IsTrue(result.StartsWith("A17 OK FETCH completed"));
             result = sim.Fetch("-1 BODY[1]");
             CustomAssert.IsTrue(result.StartsWith("A17 BAD"));
             result = sim.Fetch("-100 BODY[1]");
             CustomAssert.IsTrue(result.StartsWith("A17 BAD"));
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:19,代码来源:Fetch.cs

示例15: TestRetrievalOfMessageInDeletedFolderUsingIMAP

        public void TestRetrievalOfMessageInDeletedFolderUsingIMAP()
        {
            Application application = SingletonProvider<TestSetup>.Instance.GetApp();
             string deletedMessageText = _settings.ServerMessages.get_ItemByName("MESSAGE_FILE_MISSING").Text;

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

             SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "SampleBody");

             IMAPFolder inbox = account.IMAPFolders.get_ItemByName("Inbox");

             TestSetup.AssertFolderMessageCount(inbox, 1);

             Message message = inbox.Messages[0];

             var dir = new DirectoryInfo(Path.GetFullPath(message.Filename));
             DirectoryInfo parent = dir.Parent.Parent.Parent;
             parent.Delete(true);

             var sim = new IMAPClientSimulator();
             sim.ConnectAndLogon(account.Address, "test");
             sim.SelectFolder("INBOX");
             string result = sim.Fetch("1 BODY[1]");

             CustomAssert.IsTrue(result.Contains(deletedMessageText.Replace("%MACRO_FILE%", message.Filename)));
             TestSetup.AssertReportedError();
        }
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:27,代码来源:StabilitySanityTests.cs


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