Beispiel #1
0
        public void TestTOPSpecificPartial()
        {
            Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

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

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

             var sim = new Pop3ClientSimulator();
             sim.ConnectAndLogon(account.Address, "test");
             string result = sim.TOP(4, 2);

             Assert.IsTrue(result.Contains("Received"));
             Assert.IsTrue(result.Contains("Line1"));
             Assert.IsTrue(result.Contains("Line2"));
             Assert.IsFalse(result.Contains("Line3"));
             Assert.IsFalse(result.Contains("Line4"));
        }
Beispiel #2
0
        public void TestTOPInvalid()
        {
            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");
             Assert.IsTrue(sim.TOP(-1, 0).Contains("No such message"));
             Assert.IsTrue(sim.TOP(0, 0).Contains("No such message"));
             Assert.IsTrue(sim.TOP(100, 0).Contains("No such message"));
        }
Beispiel #3
0
        public void TestTOPSpecificEntire()
        {
            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.TOP(1, 0);

             Assert.IsTrue(result.Contains("Received"));
             Assert.IsTrue(result.Contains("Subject"));
        }
Beispiel #4
0
        public void TestTopDotOnOtherwiseEmptyLineShouldBeEscaped()
        {
            Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             SmtpClientSimulator.StaticSend(account.Address, account.Address, "Test",
                                          "Line1\r\nLine2\r\n..\r\nLine4\r\n..A\r\n.B\r\nLine6\r\n");

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

             var sim = new Pop3ClientSimulator();
             sim.ConnectAndLogon(account.Address, "test");
             string result = sim.TOP(1, 100);

             Assert.IsTrue(result.Contains("Line1\r\nLine2\r\n..\r\nLine4\r\n..A\r\nB\r\nLine6\r\n"), result);
        }