コード例 #1
0
ファイル: Basics.cs プロジェクト: jrallo/hMailServer
        public void TestUIDLWithDeleted()
        {
            Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             for (int i = 1; i <= 10; i++)
            SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "TestBody" + i.ToString());

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

             var sim = new POP3Simulator();
             sim.ConnectAndLogon(account.Address, "test");
             sim.DELE(2);
             sim.DELE(4);
             string result = sim.UIDL();

             Assert.IsTrue(result.Contains("8 messages"));
             Assert.IsTrue(result.Contains("\r\n1"));
             Assert.IsTrue(result.Contains("\r\n3"));
             Assert.IsTrue(result.Contains("\r\n5"));
             Assert.IsTrue(result.Contains("\r\n."));
        }
コード例 #2
0
ファイル: Basics.cs プロジェクト: jrallo/hMailServer
        public void TestUIDLInvalid()
        {
            Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             for (int i = 1; i <= 10; i++)
            SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "TestBody" + i.ToString());

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

             var sim = new POP3Simulator();
             sim.ConnectAndLogon(account.Address, "test");
             string result = sim.UIDL(0);
             Assert.IsTrue(result.Contains("No such message"));
             result = sim.UIDL(-1);
             Assert.IsTrue(result.Contains("No such message"));
             result = sim.UIDL(100);
             Assert.IsTrue(result.Contains("No such message"));
        }
コード例 #3
0
ファイル: Basics.cs プロジェクト: jrallo/hMailServer
        public void TestUIDLSpecific()
        {
            Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "TestBody1");
             SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "TestBody2");
             SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test", "TestBody3");

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

             var sim = new POP3Simulator();
             sim.ConnectAndLogon(account.Address, "test");
             string result = sim.UIDL(2);

             Assert.IsTrue(result.Contains("OK 2"));

             result = sim.UIDL(3);
             Assert.IsTrue(result.Contains("OK 3"));
        }
コード例 #4
0
ファイル: Basics.cs プロジェクト: jrallo/hMailServer
        public void TestLogonMailboxWithDeletedMessage()
        {
            Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             for (int i = 1; i <= 3; i++)
            SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test",
                                           "Line1\r\nLine2\r\nLine3\r\nLine4\r\nLine\r\n");

             // Mark the second message as deleted using IMAP.
             POP3Simulator.AssertMessageCount(account.Address, "test", 3);

             var sim = new IMAPSimulator();
             sim.ConnectAndLogon(account.Address, "test");
             sim.SelectFolder("INBOX");
             sim.SetDeletedFlag(2);
             sim.Disconnect();

             // Now list messages and confirm that all are listed.

             var pop3Client = new POP3Simulator();
             pop3Client.ConnectAndLogon(account.Address, "test");
             string listResponse = pop3Client.LIST();
             string uidlResponse = pop3Client.UIDL();

             Assert.IsTrue(listResponse.Contains("\r\n1"));
             Assert.IsTrue(listResponse.Contains("\r\n2"));
             Assert.IsTrue(listResponse.Contains("\r\n3"));
             Assert.IsTrue(listResponse.Contains("\r\n.\r\n"));
             Assert.IsTrue(listResponse.Contains("3 messages"));

             Assert.IsTrue(uidlResponse.Contains("\r\n1"));
             Assert.IsTrue(uidlResponse.Contains("\r\n2"));
             Assert.IsTrue(uidlResponse.Contains("\r\n3"));
             Assert.IsTrue(uidlResponse.Contains("\r\n.\r\n"));
             Assert.IsTrue(uidlResponse.Contains("3 messages"));
        }