Beispiel #1
0
        public void TestMetaDataSortCC()
        {
            Application application = SingletonProvider <TestSetup> .Instance.GetApp();

            Account account = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "meta'*****@*****.**", "test");

            // disable...
            SendMessage("Test C", "Body", "", "ÄÄÄ");
            IMAPClientSimulator.AssertMessageCount(account.Address, "test", "Inbox", 1);

            SendMessage("Test B", "Body", "", "ÖÖÖ");
            IMAPClientSimulator.AssertMessageCount(account.Address, "test", "Inbox", 2);

            SendMessage("Test A", "Body", "", "ÅÅÅ");
            IMAPClientSimulator.AssertMessageCount(account.Address, "test", "Inbox", 3);

            AssertAllMessagesIndexed();

            var sim = new IMAPClientSimulator(account.Address, "test", "Inbox");

            string result = sim.Sort("(CC) UTF-8 ALL");

            CustomAssert.AreEqual("3 1 2", result);

            // Disable the indexing functionality
            _indexing.Enabled = false;
            _indexing.Clear();

            // Make sure the sort order is the same.
            string resultAfter = sim.Sort("(CC) UTF-8 ALL");

            CustomAssert.AreEqual(result, resultAfter);
        }
Beispiel #2
0
        public void TestSubjectSearch()
        {
            Domain  oDomain  = _application.Domains[0];
            Account oAccount = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            // Send a message to this account.
            var oSMTP = new SMTPClientSimulator();

            oSMTP.Send("*****@*****.**", "*****@*****.**", "Test1", "This is a test of IMAP Search");
            IMAPClientSimulator.AssertMessageCount("*****@*****.**", "test", "INBOX", 1);
            oSMTP.Send("*****@*****.**", "*****@*****.**", "Test2", "This is a test of IMAP Search");
            IMAPClientSimulator.AssertMessageCount("*****@*****.**", "test", "INBOX", 2);

            var oSimulator = new IMAPClientSimulator();

            string sWelcomeMessage = oSimulator.Connect();

            oSimulator.Logon("*****@*****.**", "test");
            CustomAssert.IsTrue(oSimulator.SelectFolder("INBOX"));

            CustomAssert.AreEqual("1", oSimulator.Sort("(REVERSE SUBJECT) UTF-8 ALL HEADER SUBJECT \"Test1\""));
            CustomAssert.AreEqual("2", oSimulator.Sort("(REVERSE SUBJECT) UTF-8 ALL HEADER SUBJECT \"Test2\""));
            CustomAssert.AreEqual("1", oSimulator.Sort("(REVERSE SUBJECT) UTF-8 ALL (HEADER SUBJECT \"Test1\")"));
            CustomAssert.AreEqual("2", oSimulator.Sort("(REVERSE SUBJECT) UTF-8 ALL (HEADER SUBJECT \"Test2\")"));
        }
Beispiel #3
0
        public void TestSortReverseSize()
        {
            Domain  oDomain  = _application.Domains[0];
            Account oAccount = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            var longBodyString = new StringBuilder();

            longBodyString.Append('A', 10000);

            // Send a message to this account.
            var oSMTP = new SMTPClientSimulator();

            oSMTP.Send("*****@*****.**", "*****@*****.**", "Test1", longBodyString.ToString());
            IMAPClientSimulator.AssertMessageCount("*****@*****.**", "test", "INBOX", 1);

            oSMTP.Send("*****@*****.**", "*****@*****.**", "Test2", "Test body");
            IMAPClientSimulator.AssertMessageCount("*****@*****.**", "test", "INBOX", 2);

            var oSimulator = new IMAPClientSimulator();

            string sWelcomeMessage = oSimulator.Connect();

            oSimulator.Logon("*****@*****.**", "test");
            CustomAssert.IsTrue(oSimulator.SelectFolder("INBOX"));

            CustomAssert.AreEqual("2 1", oSimulator.Sort("(SIZE) UTF-8 ALL"));
            CustomAssert.AreEqual("1 2", oSimulator.Sort("(REVERSE SIZE) UTF-8 ALL"));
        }
Beispiel #4
0
        public void TestSortReverseArrival()
        {
            Domain  oDomain  = _application.Domains[0];
            Account oAccount = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            // Send a message to this account.
            var oSMTP = new SMTPClientSimulator();

            oSMTP.Send("*****@*****.**", "*****@*****.**", "Test1", "This is a test of IMAP Search");
            IMAPClientSimulator.AssertMessageCount("*****@*****.**", "test", "INBOX", 1);

            // The two messages needs to be sent a second apart, so we actually need to pause a bit here.

            Thread.Sleep(1000);
            oSMTP.Send("*****@*****.**", "*****@*****.**", "Test2", "This is a test of IMAP Search");
            IMAPClientSimulator.AssertMessageCount("*****@*****.**", "test", "INBOX", 2);

            var oSimulator = new IMAPClientSimulator();

            string sWelcomeMessage = oSimulator.Connect();

            oSimulator.Logon("*****@*****.**", "test");
            CustomAssert.IsTrue(oSimulator.SelectFolder("INBOX"));

            CustomAssert.AreEqual("1 2", oSimulator.Sort("(ARRIVAL) UTF-8 ALL"));
            CustomAssert.AreEqual("2 1", oSimulator.Sort("(REVERSE ARRIVAL) UTF-8 ALL"));
        }
Beispiel #5
0
        public void TestMetaDataSortSubjectGreek()
        {
            Application application = SingletonProvider <TestSetup> .Instance.GetApp();

            Account account = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "meta'*****@*****.**", "test");

            // disable...
            SendMessage("Test Σ", "Body", "", "");
            IMAPClientSimulator.AssertMessageCount(account.Address, "test", "Inbox", 1);
            // pos: 18

            SendMessage("Test Α", "Body", "", "");
            IMAPClientSimulator.AssertMessageCount(account.Address, "test", "Inbox", 2);
            // pos: 1

            SendMessage("Test Δ", "Body", "", "");
            IMAPClientSimulator.AssertMessageCount(account.Address, "test", "Inbox", 3);
            // pos: 4

            SendMessage("Test β", "Body", "", "");
            IMAPClientSimulator.AssertMessageCount(account.Address, "test", "Inbox", 4);
            // pos: 2

            SendMessage("Test κ", "Body", "", "");
            IMAPClientSimulator.AssertMessageCount(account.Address, "test", "Inbox", 5);
            // pos: 10

            SendMessage("Test Ψ", "Body", "", "");
            IMAPClientSimulator.AssertMessageCount(account.Address, "test", "Inbox", 6);
            // pos: 23

            AssertAllMessagesIndexed();

            var sim = new IMAPClientSimulator(account.Address, "test", "Inbox");

            string result = sim.Sort("(SUBJECT) UTF-8 ALL");

            CustomAssert.AreEqual("2 4 3 5 1 6", result);

            // Disable the indexing functionality
            _indexing.Enabled = false;
            _indexing.Clear();

            // Make sure the sort order is the same.
            string resultAfter = sim.Sort("(SUBJECT) UTF-8 ALL");

            CustomAssert.AreEqual(result, resultAfter);
        }
Beispiel #6
0
        public void TestSortDeletedOrAnswered()
        {
            Domain  oDomain  = _application.Domains[0];
            Account oAccount = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            // Send a message to this account.
            var oSMTP = new SMTPClientSimulator();

            oSMTP.Send("*****@*****.**", "*****@*****.**", "aa", "This is a test of IMAP Search");
            IMAPClientSimulator.AssertMessageCount("*****@*****.**", "test", "INBOX", 1);
            oSMTP.Send("*****@*****.**", "*****@*****.**", "bb", "This is a test of IMAP Search");
            IMAPClientSimulator.AssertMessageCount("*****@*****.**", "test", "INBOX", 2);

            var    oSimulator      = new IMAPClientSimulator();
            string sWelcomeMessage = oSimulator.Connect();

            oSimulator.Logon("*****@*****.**", "test");
            CustomAssert.IsTrue(oSimulator.SelectFolder("INBOX"));

            CustomAssert.AreEqual("", oSimulator.Sort("(DATE) UTF-8 ALL OR ANSWERED DELETED"));
        }