コード例 #1
0
ファイル: Basics.cs プロジェクト: nunodotferreira/hmailserver
        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"));
        }
コード例 #2
0
ファイル: Basics.cs プロジェクト: nunodotferreira/hmailserver
        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);
        }
コード例 #3
0
ファイル: Basics.cs プロジェクト: nunodotferreira/hmailserver
        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"));
        }
コード例 #4
0
ファイル: Basics.cs プロジェクト: nunodotferreira/hmailserver
        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"));
        }