Esempio n. 1
0
        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.
             POP3ClientSimulator.AssertMessageCount(account.Address, "test", 3);

             var sim = new IMAPClientSimulator();
             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 POP3ClientSimulator();
             pop3Client.ConnectAndLogon(account.Address, "test");
             string listResponse = pop3Client.LIST();
             string uidlResponse = pop3Client.UIDL();

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

             CustomAssert.IsTrue(uidlResponse.Contains("\r\n1"));
             CustomAssert.IsTrue(uidlResponse.Contains("\r\n2"));
             CustomAssert.IsTrue(uidlResponse.Contains("\r\n3"));
             CustomAssert.IsTrue(uidlResponse.Contains("\r\n.\r\n"));
             CustomAssert.IsTrue(uidlResponse.Contains("3 messages"));
        }
Esempio n. 2
0
        public void TestLISTSpecific()
        {
            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");

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

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

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

             result = sim.LIST(3);
             CustomAssert.IsTrue(result.Contains("OK 3"));
        }
Esempio n. 3
0
        public void TestLISTWithDeleted()
        {
            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());

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

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

             CustomAssert.IsTrue(result.Contains("8 messages"));
             CustomAssert.IsTrue(result.Contains("\r\n1"));
             CustomAssert.IsTrue(result.Contains("\r\n3"));
             CustomAssert.IsTrue(result.Contains("\r\n5"));
             CustomAssert.IsTrue(result.Contains("\r\n."));
        }
Esempio n. 4
0
        public void TestLISTInvalid()
        {
            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());

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

             var sim = new POP3ClientSimulator();
             sim.ConnectAndLogon(account.Address, "test");
             string result = sim.LIST(0);
             CustomAssert.IsTrue(result.Contains("No such message"));
             result = sim.LIST(-1);
             CustomAssert.IsTrue(result.Contains("No such message"));
             result = sim.LIST(100);
             CustomAssert.IsTrue(result.Contains("No such message"));
        }