Пример #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);
        }
Пример #2
0
        public void TestMetaDataSortSubjectTurkish()
        {
            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: 4

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

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

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

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

             AssertAllMessagesIndexed();

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

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

             CustomAssert.AreEqual("3 2 1 5 4", 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);
        }
Пример #3
0
        public void TestSubjectSearchValueWithParanthesis()
        {
            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("*****@*****.**", "*****@*****.**", "Te(st1", "This is a test of IMAP Search");
             IMAPClientSimulator.AssertMessageCount("*****@*****.**", "test", "INBOX", 1);
             oSMTP.Send("*****@*****.**", "*****@*****.**", "Te)st2", "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("(SUBJECT) UTF-8 ALL HEADER SUBJECT \"Te(st1\""));
             CustomAssert.AreEqual("2", oSimulator.Sort("(SUBJECT) UTF-8 ALL HEADER SUBJECT \"Te)st2\""));
        }
Пример #4
0
        public void TestSortSubjectSearch()
        {
            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("1 2", oSimulator.Sort("(DATE) UTF-8 ALL UNANSWERED OR HEADER SUBJECT aa HEADER SUBJECT bb"));
             CustomAssert.AreEqual("1 2",
                         oSimulator.Sort("(DATE) UTF-8 ALL UNANSWERED OR (HEADER SUBJECT aa) (HEADER SUBJECT bb)"));
             CustomAssert.AreEqual("1 2",
                         oSimulator.Sort("(DATE) UTF-8 ALL UNANSWERED (OR HEADER SUBJECT aa HEADER SUBJECT bb)"));

             CustomAssert.AreEqual("1", oSimulator.Sort("(DATE) UTF-8 ALL UNANSWERED OR HEADER SUBJECT aa HEADER SUBJECT cc"));
             CustomAssert.AreEqual("1",
                         oSimulator.Sort("(DATE) UTF-8 ALL UNANSWERED OR (HEADER SUBJECT aa) (HEADER SUBJECT cc)"));
             CustomAssert.AreEqual("1", oSimulator.Sort("(DATE) UTF-8 ALL UNANSWERED (OR HEADER SUBJECT aa HEADER SUBJECT cc)"));

             CustomAssert.AreEqual("2", oSimulator.Sort("(DATE) UTF-8 ALL UNANSWERED OR HEADER SUBJECT bb HEADER SUBJECT cc"));
             CustomAssert.AreEqual("2",
                         oSimulator.Sort("(DATE) UTF-8 ALL UNANSWERED OR (HEADER SUBJECT bb) (HEADER SUBJECT cc)"));
             CustomAssert.AreEqual("2", oSimulator.Sort("(DATE) UTF-8 ALL UNANSWERED (OR HEADER SUBJECT bb HEADER SUBJECT cc)"));
        }
Пример #5
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"));
        }
Пример #6
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"));
        }
Пример #7
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"));
        }