Пример #1
3
        public void TestSearchOR()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();

             ;
             hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             // Send a message to this account.
             SMTPClientSimulator oSMTP = new SMTPClientSimulator();
             oSMTP.Send("*****@*****.**", "*****@*****.**", "Search test", "This is a test of IMAP Search");
             IMAPSimulator.AssertMessageCount("*****@*****.**", "test", "INBOX", 1);

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon("*****@*****.**", "test");
             Assert.IsTrue(oSimulator.SelectFolder("INBOX"));

             if (oSimulator.Search("OR SINCE 28-May-2001 ON 28-May-2001 ALL") != "1")
             {
            throw new Exception("ERROR - Search or flag failed");
             }

             if (oSimulator.Search("OR SINCE 28-May-2012 ON 28-May-2012 ALL") != "")
             {
            throw new Exception("ERROR - Search or flag failed");
             }

             string formattedToday = DateTime.Now.ToString("dd-MMM-yyyy", System.Globalization.CultureInfo.InvariantCulture).ToUpper();
             if (oSimulator.Search("OR SINCE 28-May-2017 ON " + formattedToday + " ALL") != "1")
             {
            throw new Exception("ERROR - Search or flag failed");
             }

             string formatted2001 = new DateTime(2001,01,01).ToString("dd-MMM-yyyy").ToUpper();
             if (oSimulator.Search("OR SINCE 28-May-2008 ON " + formatted2001 + " ALL") != "1")
             {
            throw new Exception("ERROR - Search or flag failed");
             }
        }
Пример #2
0
        public void TestFetchHeaderFieldsNot()
        {
            hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            string message = "From: Someone <*****@*****.**>" + Environment.NewLine +
                             "To: Someoen <*****@*****.**>" + Environment.NewLine +
                             "Date: Wed, 22 Apr 2009 11:05:09 \"GMT\"" + Environment.NewLine +
                             "Subject: Something" + Environment.NewLine +
                             Environment.NewLine +
                             "Hello" + Environment.NewLine;

            SMTPClientSimulator smtpSimulator = new SMTPClientSimulator();

            Assert.IsTrue(smtpSimulator.SendRaw(account.Address, account.Address, message));

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

            IMAPSimulator oSimulator      = new IMAPSimulator();
            string        sWelcomeMessage = oSimulator.Connect();

            oSimulator.Logon(account.Address, "test");
            oSimulator.SelectFolder("INBOX");
            string result = oSimulator.Fetch("1 BODY.PEEK[HEADER.FIELDS.NOT (Subject From)]");

            oSimulator.Disconnect();


            Assert.IsTrue(result.Contains("Received:"), result);
            Assert.IsFalse(result.Contains("Subject:"), result);
            Assert.IsFalse(result.Contains("From:"), result);
            // The feedback should end with an empty header line.
            Assert.IsTrue(result.Contains("\r\n\r\n)"), result);
        }
Пример #3
0
        public void ConfirmFileAddedToCorrectAccountFolder()
        {
            Utilities utilities = SingletonProvider <Utilities> .Instance;

            hMailServer.Account oAccount   = utilities.AddAccount(_domain, "*****@*****.**", "test");
            IMAPSimulator       oSimulator = new IMAPSimulator();

            // Confirm that the public folder is empty before we start our test.
            string publicDir = utilities.GetPublicDirectory();

            utilities.AssertFilesInDirectory(publicDir, 0);

            // Add a message to the inbox.
            oSimulator.Connect();
            oSimulator.LogonWithLiteral("*****@*****.**", "test");
            oSimulator.SendSingleCommandWithLiteral("A01 APPEND INBOX {4}", "ABCD");

            // Confirm it exists in the IMAP folder.
            Assert.AreEqual(1, oSimulator.GetMessageCount("INBOX"));
            oSimulator.Disconnect();

            // The public directory should still be empty - the message was added to the user account.
            utilities.AssertFilesInDirectory(publicDir, 0);

            // There should be a single file in the users directory.
            utilities.AssertFilesInUserDirectory(oAccount, 1);
        }
Пример #4
0
        public void TestFetchEnvelopeWithDateContainingQuote()
        {
            hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            string message = "From: Someone <*****@*****.**>" + Environment.NewLine +
                             "To: Someoen <*****@*****.**>" + Environment.NewLine +
                             "Date: Wed, 22 Apr 2009 11:05:09 \"GMT\"" + Environment.NewLine +
                             "Subject: Something" + Environment.NewLine +
                             Environment.NewLine +
                             "Hello" + Environment.NewLine;

            SMTPClientSimulator smtpSimulator = new SMTPClientSimulator();

            smtpSimulator.SendRaw(account.Address, account.Address, message);

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

            IMAPSimulator oSimulator      = new IMAPSimulator();
            string        sWelcomeMessage = oSimulator.Connect();

            oSimulator.Logon(account.Address, "test");
            oSimulator.SelectFolder("INBOX");
            string result = oSimulator.Fetch("1 ENVELOPE");

            oSimulator.Disconnect();

            Assert.IsTrue(result.Contains("Wed, 22 Apr 2009 11:05:09 GMT"));
        }
Пример #5
0
        public void TestNestedOr()
        {
            hMailServer.Application application = SingletonProvider <Utilities> .Instance.GetApp();

            ;
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

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

            oSMTP.Send("*****@*****.**", "*****@*****.**", "Search test", "This is a test of IMAP Search");

            IMAPSimulator.AssertMessageCount(oAccount.Address, "test", "Inbox", 1);

            IMAPSimulator oSimulator      = new IMAPSimulator();
            string        sWelcomeMessage = oSimulator.Connect();

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


            string result = oSimulator.SendSingleCommand("A4 SEARCH OR OR OR OR OR OR SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 ALL");

            Assert.IsTrue(result.StartsWith("* SEARCH"), result);

            result = oSimulator.SendSingleCommand("A4 SEARCH OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR OR SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008 ALL");
            Assert.IsTrue(result.StartsWith("A4 NO"), result);
        }
Пример #6
0
        public void TestHierarchyDelimiterDelete()
        {
            hMailServer.Application application = SingletonProvider <Utilities> .Instance.GetApp();

            hMailServer.Settings settings = _settings;
            settings.IMAPHierarchyDelimiter = "\\";

            hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            string folderName = "Test\\Test";

            IMAPSimulator oSimulator      = new IMAPSimulator();
            string        sWelcomeMessage = oSimulator.Connect();

            oSimulator.Logon(account.Address, "test");
            Assert.IsTrue(oSimulator.CreateFolder(folderName));
            string listResponse = oSimulator.List();

            Assert.IsTrue(listResponse.Contains("\"Test\\Test\""));
            Assert.IsTrue(listResponse.Contains("\"Test\""));
            Assert.IsTrue(oSimulator.DeleteFolder("Test\\Test"));
            listResponse = oSimulator.List();
            Assert.IsFalse(listResponse.Contains("Test\\Test"));
            Assert.IsTrue(listResponse.Contains("Test"));
            oSimulator.Disconnect();
        }
Пример #7
0
        public void TestSortReverseSize()
        {
            hMailServer.Domain  oDomain  = _application.Domains[0];
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            StringBuilder longBodyString = new StringBuilder();

            longBodyString.Append('A', 10000);

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

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

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

            IMAPSimulator oSimulator = new IMAPSimulator();

            string sWelcomeMessage = oSimulator.Connect();

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

            Assert.AreEqual("2 1", oSimulator.Sort("(SIZE) UTF-8 ALL"));
            Assert.AreEqual("1 2", oSimulator.Sort("(REVERSE SIZE) UTF-8 ALL"));
        }
Пример #8
0
        public void TestDateSortOrder()
        {
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            IMAPSimulator oSimulator = new IMAPSimulator();

            string sWelcomeMessage = oSimulator.Connect();

            oSimulator.LogonWithLiteral("*****@*****.**", "test");
            Assert.IsTrue(oSimulator.SelectFolder("Inbox"));

            string response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 22:00:00 +0200\" {37}", "Date: Wed, 15 Dec 2010 13:00:00 +0000");

            Assert.IsTrue(response.Contains("* 1 EXISTS"), response);

            response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 21:00:00 +0200\" {37}", "Date: Wed, 15 Dec 2010 14:00:00 +0000");
            Assert.IsTrue(response.Contains("* 2 EXISTS"), response);

            response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 20:00:00 +0200\" {37}", "Date: Wed, 15 Dec 2010 12:00:00 +0000");
            Assert.IsTrue(response.Contains("* 3 EXISTS"), response);

            response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"23-Feb-2008 01:30:23 +0200\" {37}", "Date: Wed, 15 Dec 2010 11:00:00 +0000");
            Assert.IsTrue(response.Contains("* 4 EXISTS"), response);

            string sortDateResponse = oSimulator.SendSingleCommand("A10 SORT (DATE) US-ASCII ALL");

            Assert.IsTrue(sortDateResponse.Contains(" 4 3 1 2"));
            oSimulator.Disconnect();
        }
Пример #9
0
        public void TestSearchORWithLiterals3()
        {
            hMailServer.Application application = SingletonProvider <Utilities> .Instance.GetApp();

            ;
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

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

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

            IMAPSimulator oSimulator = new IMAPSimulator();

            string sWelcomeMessage = oSimulator.Connect();

            oSimulator.Logon("*****@*****.**", "test");

            Assert.IsTrue(oSimulator.SelectFolder("INBOX"));

            string result = oSimulator.Send("A01 SEARCH ALL OR (HEADER SUBJECT {5}");

            result = oSimulator.Send("Test5) (HEADER SUBJECT {5}");
            result = oSimulator.Send("Test2)");
            Assert.IsTrue(result.StartsWith("* SEARCH 2"));
        }
Пример #10
0
        public void TestSortReverseArrival()
        {
            hMailServer.Domain  oDomain  = _application.Domains[0];
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

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

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

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

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

            IMAPSimulator oSimulator = new IMAPSimulator();

            string sWelcomeMessage = oSimulator.Connect();

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

            Assert.AreEqual("1 2", oSimulator.Sort("(ARRIVAL) UTF-8 ALL"));
            Assert.AreEqual("2 1", oSimulator.Sort("(REVERSE ARRIVAL) UTF-8 ALL"));
        }
Пример #11
0
        public void TestSortSubjectSearch()
        {
            hMailServer.Domain  oDomain  = _application.Domains[0];
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

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

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

            IMAPSimulator oSimulator      = new IMAPSimulator();
            string        sWelcomeMessage = oSimulator.Connect();

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

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

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

            Assert.AreEqual("2", oSimulator.Sort("(DATE) UTF-8 ALL UNANSWERED OR HEADER SUBJECT bb HEADER SUBJECT cc"));
            Assert.AreEqual("2", oSimulator.Sort("(DATE) UTF-8 ALL UNANSWERED OR (HEADER SUBJECT bb) (HEADER SUBJECT cc)"));
            Assert.AreEqual("2", oSimulator.Sort("(DATE) UTF-8 ALL UNANSWERED (OR HEADER SUBJECT bb HEADER SUBJECT cc)"));
        }
Пример #12
0
        public void TestDateSortOrderNonexistantDate()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");
             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral("*****@*****.**", "test");
             Assert.IsTrue(oSimulator.SelectFolder("Inbox"));

             string response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 22:00:00 +0200\" {4}", "ABCD");
             Assert.IsTrue(response.Contains("* 1 EXISTS"), response);

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 21:00:00 +0200\" {4}", "ABCD");
             Assert.IsTrue(response.Contains("* 2 EXISTS"), response);

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 20:00:00 +0200\" {4}", "ABCD");
             Assert.IsTrue(response.Contains("* 3 EXISTS"), response);

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"23-Feb-2008 01:30:23 +0200\" {4}", "ABCD");
             Assert.IsTrue(response.Contains("* 4 EXISTS"), response);

             /*
              * RFC 5256 "2.2. Sent Date" chapter. If the sent date cannot be determined (a Date: header is missing or cannot be parsed),
              * the INTERNALDATE for that message is used as the sent date.
              */

             string sortDateResponse = oSimulator.SendSingleCommand("A10 SORT (DATE) US-ASCII ALL");
             string sortArivalDateResponse = oSimulator.SendSingleCommand("A10 SORT (ARRIVAL) US-ASCII ALL");

             Assert.IsTrue(sortArivalDateResponse.Contains(" 3 2 1 4"));
             Assert.AreEqual(sortDateResponse, sortArivalDateResponse);
             oSimulator.Disconnect();
        }
Пример #13
0
        public void TestDateSortOrder()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");
             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral("*****@*****.**", "test");
             Assert.IsTrue(oSimulator.SelectFolder("Inbox"));

             string response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 22:00:00 +0200\" {37}", "Date: Wed, 15 Dec 2010 13:00:00 +0000");
             Assert.IsTrue(response.Contains("* 1 EXISTS"), response);

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 21:00:00 +0200\" {37}", "Date: Wed, 15 Dec 2010 14:00:00 +0000");
             Assert.IsTrue(response.Contains("* 2 EXISTS"), response);

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"22-Feb-2008 20:00:00 +0200\" {37}", "Date: Wed, 15 Dec 2010 12:00:00 +0000");
             Assert.IsTrue(response.Contains("* 3 EXISTS"), response);

             response = oSimulator.SendSingleCommandWithLiteral("A04 APPEND INBOX \"23-Feb-2008 01:30:23 +0200\" {37}", "Date: Wed, 15 Dec 2010 11:00:00 +0000");
             Assert.IsTrue(response.Contains("* 4 EXISTS"), response);

             string sortDateResponse = oSimulator.SendSingleCommand("A10 SORT (DATE) US-ASCII ALL");

             Assert.IsTrue(sortDateResponse.Contains(" 4 3 1 2"));
             oSimulator.Disconnect();
        }
Пример #14
0
        public void TestSubjectSearchMultipleMatches()
        {
            hMailServer.Domain  oDomain  = _application.Domains[0];
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

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

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

            IMAPSimulator oSimulator = new IMAPSimulator();

            string sWelcomeMessage = oSimulator.Connect();

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

            Assert.AreEqual("1 3", oSimulator.Sort("(SUBJECT) UTF-8 ALL HEADER SUBJECT \"Test1\""));
            Assert.AreEqual("2", oSimulator.Sort("(SUBJECT) UTF-8 ALL HEADER SUBJECT \"TestA\""));
            Assert.AreEqual("3 1", oSimulator.Sort("(REVERSE SUBJECT) UTF-8 ALL HEADER SUBJECT \"Test1\""));
            Assert.AreEqual("2", oSimulator.Sort("(REVERSE SUBJECT) UTF-8 ALL HEADER SUBJECT \"TestA\""));
            Assert.AreEqual("3 1", oSimulator.Sort("(REVERSE SUBJECT) UTF-8 ALL (HEADER SUBJECT) \"Test1\""));
            Assert.AreEqual("2", oSimulator.Sort("(REVERSE SUBJECT) UTF-8 ALL (HEADER SUBJECT) \"TestA\""));
        }
Пример #15
0
        public void ConfirmFileAddedToCorrectAccountFolder()
        {
            Utilities utilities = SingletonProvider<Utilities>.Instance;
            hMailServer.Account oAccount = utilities.AddAccount(_domain, "*****@*****.**", "test");
            IMAPSimulator oSimulator = new IMAPSimulator();

            // Confirm that the public folder is empty before we start our test.
            string publicDir = utilities.GetPublicDirectory();
            utilities.AssertFilesInDirectory(publicDir, 0);

            // Add a message to the inbox.
            oSimulator.Connect();
            oSimulator.LogonWithLiteral("*****@*****.**", "test");
            oSimulator.SendSingleCommandWithLiteral("A01 APPEND INBOX {4}", "ABCD");

            // Confirm it exists in the IMAP folder.
            Assert.AreEqual(1, oSimulator.GetMessageCount("INBOX"));
            oSimulator.Disconnect();

            // The public directory should still be empty - the message was added to the user account.
            utilities.AssertFilesInDirectory(publicDir, 0);

            // There should be a single file in the users directory.
            utilities.AssertFilesInUserDirectory(oAccount, 1);
        }
Пример #16
0
        public void ExamineFolderRequiresReadPermission()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();

             hMailServer.Account account1 = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             hMailServer.IMAPFolders publicFolders = _settings.PublicFolders;
             hMailServer.IMAPFolder folder = publicFolders.Add("Share1");
             folder.Save();

             hMailServer.IMAPFolderPermission permission = folder.Permissions.Add();
             permission.PermissionAccountID = account1.ID;
             permission.PermissionType = hMailServer.eACLPermissionType.ePermissionTypeUser;
             permission.set_Permission(hMailServer.eACLPermission.ePermissionLookup, true);
             permission.Save();

             string selectResult = string.Empty;

             IMAPSimulator oSimulator1 = new IMAPSimulator();
             oSimulator1.Connect();
             oSimulator1.LogonWithLiteral(account1.Address, "test");
             string examineResult = oSimulator1.ExamineFolder("#Public.Share1");
             oSimulator1.Disconnect();

             Assert.IsTrue(examineResult.Contains("ACL: Read permission denied (Required for EXAMINE command)."), examineResult);
        }
Пример #17
0
        public void TestSearchORWithParenthesisSubjectNested()
        {
            hMailServer.Application application = SingletonProvider <Utilities> .Instance.GetApp();

            ;
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

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

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

            IMAPSimulator oSimulator = new IMAPSimulator();

            string sWelcomeMessage = oSimulator.Connect();

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

            if (oSimulator.Search("ALL (OR (HEADER SUBJECT \"Test1\") (HEADER SUBJECT \"Test2\"))") != "1 2")
            {
                throw new Exception("ERROR - Search or flag failed");
            }
        }
Пример #18
0
        public void FolderMarkedAsReadOnlyWhenUserHasReadOnlyRights()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();

             hMailServer.Account account1 = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             hMailServer.IMAPFolders publicFolders = _settings.PublicFolders;
             hMailServer.IMAPFolder folder = publicFolders.Add("Share1");
             folder.Save();

             hMailServer.IMAPFolderPermission permission = folder.Permissions.Add();
             permission.PermissionAccountID = account1.ID;
             permission.PermissionType = hMailServer.eACLPermissionType.ePermissionTypeUser;
             permission.set_Permission(hMailServer.eACLPermission.ePermissionLookup, true);
             permission.set_Permission(hMailServer.eACLPermission.ePermissionRead, true);
             permission.Save();

             string selectResult = string.Empty;

             IMAPSimulator oSimulator1 = new IMAPSimulator();
             oSimulator1.Connect();
             oSimulator1.LogonWithLiteral(account1.Address, "test");
             oSimulator1.SelectFolder("#Public.Share1", out selectResult);
             oSimulator1.Disconnect();

             Assert.IsTrue(selectResult.Contains("[READ-ONLY]"), selectResult);
             Assert.IsFalse(selectResult.Contains("[READ-WRITE]"), selectResult);
        }
Пример #19
0
        public void TestListSpecial()
        {
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            IMAPSimulator oSimulator      = new IMAPSimulator();
            string        sWelcomeMessage = oSimulator.Connect();

            oSimulator.Logon(oAccount.Address, "test");
            string response = oSimulator.List("");

            Assert.IsTrue(response.StartsWith("* LIST (\\Noselect) \".\" \"\""));
            oSimulator.Disconnect();

            _settings.IMAPHierarchyDelimiter = "/";

            oSimulator      = new IMAPSimulator();
            sWelcomeMessage = oSimulator.Connect();
            oSimulator.Logon(oAccount.Address, "test");
            response = oSimulator.List("");
            Assert.IsTrue(response.StartsWith("* LIST (\\Noselect) \"/\" \"\""));
            oSimulator.Disconnect();

            _settings.IMAPHierarchyDelimiter = "\\";

            oSimulator      = new IMAPSimulator();
            sWelcomeMessage = oSimulator.Connect();
            oSimulator.Logon(oAccount.Address, "test");
            response = oSimulator.List("", false);
            string expectedResponse = "* LIST (\\Noselect) \"\\\\\" \"\"";

            Assert.IsTrue(response.StartsWith(expectedResponse));
            oSimulator.Disconnect();
        }
Пример #20
0
        public void TestNestedOrSearch()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();

              ;
              hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

              // Send a message to this account.
              SMTPClientSimulator oSMTP = new SMTPClientSimulator();
              oSMTP.Send("*****@*****.**", "*****@*****.**", "Search test", "This is a test of IMAP Search");

              IMAPSimulator.AssertMessageCount(oAccount.Address, "test", "Inbox", 1);

              IMAPSimulator oSimulator = new IMAPSimulator();
              string sWelcomeMessage = oSimulator.Connect();
              oSimulator.Logon("*****@*****.**", "test");
              oSimulator.SelectFolder("INBOX");

              string result = oSimulator.SendSingleCommand("A4 SEARCH ALL OR OR SINCE 28-May-2008 SINCE 28-May-2008 SINCE 28-May-2008");
              Assert.IsTrue(result.StartsWith("* SEARCH 1"), result);

              result = oSimulator.SendSingleCommand("A4 SEARCH ALL OR SMALLER 1 LARGER 10000");
              Assert.IsTrue(result.StartsWith("* SEARCH\r\n"), result);

              result = oSimulator.SendSingleCommand("A4 SEARCH ALL OR OR SMALLER 1 LARGER 10000 SMALLER 10000");
              Assert.IsTrue(result.StartsWith("* SEARCH 1\r\n"), result);
        }
Пример #21
0
        public void TestSearchON()
        {
            hMailServer.Application application = SingletonProvider <Utilities> .Instance.GetApp();

            ;
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

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

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

            IMAPSimulator oSimulator = new IMAPSimulator();

            string sWelcomeMessage = oSimulator.Connect();

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

            string formattedTomorrow = (DateTime.Now + new TimeSpan(1, 0, 0, 0)).ToString("dd-MMM-yyyy", System.Globalization.CultureInfo.InvariantCulture).ToUpper();
            string formattedToday    = DateTime.Now.ToString("dd-MMM-yyyy", System.Globalization.CultureInfo.InvariantCulture).ToUpper();

            if (oSimulator.Search("ON " + formattedTomorrow) != "")
            {
                throw new Exception("ERROR - Search or flag failed");
            }

            if (oSimulator.Search("ON " + formattedToday) != "1")
            {
                throw new Exception("ERROR - Search or flag failed");
            }
        }
Пример #22
0
        public void TestCreateLongFolder()
        {
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            IMAPSimulator oSimulator = new IMAPSimulator();

            string sWelcomeMessage = oSimulator.Connect();

            oSimulator.LogonWithLiteral(oAccount.Address, "test");

            string folderName = "";

            for (int i = 0; i < 255; i++)
            {
                folderName = folderName + "A";
            }

            string result = oSimulator.Send("A01 CREATE " + folderName);

            Assert.IsTrue(result.Contains("A01 OK"));
            Assert.IsTrue(oSimulator.SelectFolder(folderName));

            folderName = "";
            for (int i = 0; i < 256; i++)
            {
                folderName = folderName + "A";
            }

            result = oSimulator.Send("A01 CREATE " + folderName);
            Assert.IsTrue(result.Contains("A01 NO"));
            Assert.IsFalse(oSimulator.SelectFolder(folderName));

            oSimulator.Disconnect();
        }
 public void TestIMAPServerLiteral()
 {
     IMAPSimulator sim = new IMAPSimulator();
     sim.Connect();
     Assert.IsTrue(sim.Send("a01 login " + GetUsername() + " {4}").StartsWith("+"));
     sim.Send(GetPassword());
     EnsureNoPassword();
 }
Пример #24
0
        public void TestIMAPServerLiteral()
        {
            IMAPSimulator sim = new IMAPSimulator();

            sim.Connect();
            Assert.IsTrue(sim.Send("a01 login " + GetUsername() + " {4}").StartsWith("+"));
            sim.Send(GetPassword());
            EnsureNoPassword();
        }
Пример #25
0
        public void TestCreateFolderWithHash()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon(oAccount.Address, "test");
             Assert.IsFalse(oSimulator.CreateFolder("#Test"));
             Assert.IsTrue(oSimulator.CreateFolder("Test.#Testar"));
             oSimulator.Disconnect();
        }
Пример #26
0
        public void TestAppendBadLiteral()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral("*****@*****.**", "test");
             oSimulator.SendSingleCommandWithLiteral("A01 APPEND INBOX {TEST}", "ABCD");
             Assert.AreEqual(0, oSimulator.GetMessageCount("INBOX"));
             oSimulator.Disconnect();
        }
Пример #27
0
        public void TestCreateDeepFolder()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral(oAccount.Address, "test");
             string result = oSimulator.Send("A01 CREATE 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26");
             Assert.IsTrue(result.Contains("A01 NO"));

             oSimulator.Disconnect();
        }
Пример #28
0
        public void TestAppend()
        {
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            IMAPSimulator oSimulator = new IMAPSimulator();

            string sWelcomeMessage = oSimulator.Connect();

            oSimulator.LogonWithLiteral("*****@*****.**", "test");
            oSimulator.SendSingleCommandWithLiteral("A01 APPEND INBOX {4}", "ABCD");
            Assert.AreEqual(1, oSimulator.GetMessageCount("INBOX"));
            oSimulator.Disconnect();
        }
Пример #29
0
        public void TestCreateFolderWithHash()
        {
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            IMAPSimulator oSimulator = new IMAPSimulator();

            string sWelcomeMessage = oSimulator.Connect();

            oSimulator.Logon(oAccount.Address, "test");
            Assert.IsFalse(oSimulator.CreateFolder("#Test"));
            Assert.IsTrue(oSimulator.CreateFolder("Test.#Testar"));
            oSimulator.Disconnect();
        }
Пример #30
0
        public void TestCreateFolderWithSlash()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

              string folderName = "ABC\\123";

              IMAPSimulator oSimulator = new IMAPSimulator();
              string sWelcomeMessage = oSimulator.Connect();
              oSimulator.Logon(oAccount.Address, "test");
              Assert.IsTrue(oSimulator.CreateFolder(folderName));
              Assert.IsTrue(oSimulator.List().Contains(folderName));
              Assert.IsTrue(oSimulator.SelectFolder(folderName));
              oSimulator.Disconnect();
        }
Пример #31
0
        public void TestFolderLSUBUnsubscribedFolder()
        {
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            string folderName = "ABC.def.GHI";

            IMAPSimulator oSimulator      = new IMAPSimulator();
            string        sWelcomeMessage = oSimulator.Connect();

            oSimulator.Logon(oAccount.Address, "test");
            Assert.IsTrue(oSimulator.CreateFolder(folderName));
            Assert.IsFalse(oSimulator.LSUB().Contains("\r\n\r\n"));
            oSimulator.Disconnect();
        }
Пример #32
0
        public void TestRenameToAndFromINBOX()
        {
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            IMAPSimulator oSimulator = new IMAPSimulator();

            string sWelcomeMessage = oSimulator.Connect();

            oSimulator.LogonWithLiteral(oAccount.Address, "test");
            oSimulator.Send("A01 CREATE A\r\n");
            Assert.IsFalse(oSimulator.RenameFolder("A", "INBOX"));
            Assert.IsFalse(oSimulator.RenameFolder("INBOX", "B"));

            oSimulator.Disconnect();
        }
Пример #33
0
        public void TestCreateDeepFolder()
        {
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            IMAPSimulator oSimulator = new IMAPSimulator();

            string sWelcomeMessage = oSimulator.Connect();

            oSimulator.LogonWithLiteral(oAccount.Address, "test");
            string result = oSimulator.Send("A01 CREATE 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26");

            Assert.IsTrue(result.Contains("A01 NO"));

            oSimulator.Disconnect();
        }
Пример #34
0
        public void TestCreateFolderWithSlash()
        {
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            string folderName = "ABC\\123";

            IMAPSimulator oSimulator      = new IMAPSimulator();
            string        sWelcomeMessage = oSimulator.Connect();

            oSimulator.Logon(oAccount.Address, "test");
            Assert.IsTrue(oSimulator.CreateFolder(folderName));
            Assert.IsTrue(oSimulator.List().Contains(folderName));
            Assert.IsTrue(oSimulator.SelectFolder(folderName));
            oSimulator.Disconnect();
        }
Пример #35
0
        public void TestExamine()
        {
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            IMAPSimulator oSimulator = new IMAPSimulator();

            string sWelcomeMessage = oSimulator.Connect();

            oSimulator.Logon(oAccount.Address, "test");
            Assert.IsTrue(oSimulator.CreateFolder("TestFolder"));
            string result = oSimulator.ExamineFolder("TestFolder");

            Assert.IsTrue(result.Contains("[PERMANENTFLAGS ()]"), result);
            Assert.IsTrue(result.Contains("[READ-ONLY]"), result);
        }
Пример #36
0
        public void TestSearchUID()
        {
            hMailServer.Application application = SingletonProvider <Utilities> .Instance.GetApp();

            ;
            hMailServer.Account account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

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

            for (int i = 0; i < 3; i++)
            {
                oSMTP.Send("*****@*****.**", "*****@*****.**", "Test1", "This is a test of IMAP Search");
            }

            IMAPSimulator.AssertMessageCount("*****@*****.**", "test", "INBOX", 3);

            // There should be 3 UID's, 1,2,3 or similar. No skips in the middle fo them.
            IMAPSimulator oSimulator      = new IMAPSimulator();
            string        sWelcomeMessage = oSimulator.Connect();

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

            string result = oSimulator.SendSingleCommand("* UID SEARCH UID 1:*");

            // Potentially, the response is multiline. (UID RESPONSE and an OK line). We only want the first line...
            result = result.Substring(0, result.IndexOf("\r\n"));

            string [] tokens = Microsoft.VisualBasic.Strings.Split(result, " ", -1, Microsoft.VisualBasic.CompareMethod.Text);

            List <int> uids = new List <int>();

            foreach (string token in tokens)
            {
                int temp;
                if (Int32.TryParse(token, out temp))
                {
                    uids.Add(temp);
                }
            }

            Assert.AreEqual(3, uids.Count, result);

            Assert.AreEqual(1, uids[0]);
            Assert.AreEqual(2, uids[1]);
            Assert.AreEqual(3, uids[2]);
        }
Пример #37
0
        public void TestRenameIncorrectParameters()
        {
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            IMAPSimulator oSimulator = new IMAPSimulator();

            string sWelcomeMessage = oSimulator.Connect();

            oSimulator.LogonWithLiteral(oAccount.Address, "test");
            string result = oSimulator.Send("A01 CREATE A");

            result = oSimulator.Send("A02 RENAME A B C");
            Assert.IsTrue(result.Contains("A02 BAD"));

            oSimulator.Disconnect();
        }
Пример #38
0
        public void TestCreateParallelFolder()
        {
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            IMAPSimulator oSimulator = new IMAPSimulator();

            string sWelcomeMessage = oSimulator.Connect();

            oSimulator.LogonWithLiteral(oAccount.Address, "test");
            string result = oSimulator.Send("A01 CREATE 1.2.3");

            Assert.IsTrue(result.Contains("A01 OK"));
            result = oSimulator.Send("A01 CREATE 1.2.4");
            Assert.IsTrue(result.Contains("A01 OK"));

            oSimulator.Disconnect();
        }
Пример #39
0
        public void TestFolderCaseInLIST()
        {
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            string folderName = "ABC.def.GHI";

            IMAPSimulator oSimulator      = new IMAPSimulator();
            string        sWelcomeMessage = oSimulator.Connect();

            oSimulator.Logon(oAccount.Address, "test");
            Assert.IsTrue(oSimulator.CreateFolder(folderName));
            Assert.IsFalse(oSimulator.List("ABC.DEF.*").Contains("ABC.def.GHI"));
            Assert.IsTrue(oSimulator.List("ABC.DEF.*").Contains("ABC.DEF.GHI"));
            Assert.IsFalse(oSimulator.List("ABC.def.*").Contains("ABC.DEF"));
            Assert.IsTrue(oSimulator.List("ABC.def.*").Contains("ABC.def.GHI"));
            Assert.IsTrue(oSimulator.SelectFolder(folderName));
            oSimulator.Disconnect();
        }
Пример #40
0
        public void TestRenameLongFolder()
        {
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            IMAPSimulator oSimulator = new IMAPSimulator();

            string sWelcomeMessage = oSimulator.Connect();

            oSimulator.LogonWithLiteral(oAccount.Address, "test");
            Assert.IsTrue(oSimulator.CreateFolder("1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25"));
            Assert.IsTrue(oSimulator.CreateFolder("A"));

            Assert.IsFalse(oSimulator.RenameFolder("1", "A.1"));
            Assert.IsTrue(oSimulator.RenameFolder("1.2.3", "A.1"));
            Assert.IsTrue(oSimulator.SelectFolder("A.1.4"));


            oSimulator.Disconnect();
        }
        public void TestHierarchyDelimiterListResponse()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();
            hMailServer.Settings settings = _settings;
            settings.IMAPHierarchyDelimiter = "\\";

            hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

            string folderName = "Test\\Test";

            IMAPSimulator oSimulator = new IMAPSimulator();
            string sWelcomeMessage = oSimulator.Connect();
            oSimulator.Logon(account.Address, "test");
            Assert.IsTrue(oSimulator.CreateFolder(folderName));
            string listResponse = oSimulator.List();
            Assert.IsTrue(listResponse.Contains("\"Test\\Test\""));
            Assert.IsTrue(listResponse.Contains("\"Test\""));
            oSimulator.Disconnect();
        }
Пример #42
0
        public void TestSearchSpecficUID()
        {
            hMailServer.Application application = SingletonProvider <Utilities> .Instance.GetApp();

            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

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

            for (int i = 0; i < 5; i++)
            {
                oSMTP.Send("*****@*****.**", "*****@*****.**", "Test1", "This is a test of IMAP Search");
            }

            IMAPSimulator.AssertMessageCount("*****@*****.**", "test", "INBOX", 5);

            hMailServer.Messages messages = oAccount.IMAPFolders.get_ItemByName("Inbox").Messages;

            int second = messages[1].UID;
            int third  = messages[2].UID;
            int fourth = messages[3].UID;


            IMAPSimulator oSimulator      = new IMAPSimulator();
            string        sWelcomeMessage = oSimulator.Connect();

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

            string result = oSimulator.SendSingleCommand(string.Format("a01 SORT (REVERSE DATE) UTF-8 ALL UID {0},{1}", second, third));

            Assert.IsTrue(result.StartsWith("* SORT 3 2"));

            result = oSimulator.SendSingleCommand(string.Format("a01 SORT (DATE) UTF-8 ALL UID {0},{1}", third, second));
            Assert.IsTrue(result.StartsWith("* SORT 2 3"));

            result = oSimulator.SendSingleCommand(string.Format("a01 SORT (DATE) UTF-8 ALL UID {0}:{1}", second, fourth));
            Assert.IsTrue(result.StartsWith("* SORT 2 3 4"));

            result = oSimulator.SendSingleCommand(string.Format("a01 SORT (DATE) UTF-8 ALL UID {0}:*", second));
            Assert.IsTrue(result.StartsWith("* SORT 2 3 4 5"));
        }
Пример #43
0
        public void TestRenameToParallelFolder()
        {
            hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            IMAPSimulator oSimulator = new IMAPSimulator();

            string sWelcomeMessage = oSimulator.Connect();

            oSimulator.LogonWithLiteral(oAccount.Address, "test");
            Assert.IsTrue(oSimulator.CreateFolder("Main.Sub"));
            Assert.IsTrue(oSimulator.RenameFolder("Main.Sub", "Second.Sub"));

            string listResponse = oSimulator.List();

            Assert.IsFalse(listResponse.Contains("Main.Sub"));
            Assert.IsTrue(listResponse.Contains("Second.Sub"));


            oSimulator.Disconnect();
        }
Пример #44
0
        public void ConfirmFileAddedToCorrectPublicFolder()
        {
            Utilities utilities = SingletonProvider<Utilities>.Instance;
            hMailServer.Account oAccount = utilities.AddAccount(_domain, "*****@*****.**", "test");
            IMAPSimulator oSimulator = new IMAPSimulator();

            // Confirm that the public folder is empty before we start our test.
            string publicDir = utilities.GetPublicDirectory();
            utilities.AssertFilesInDirectory(publicDir, 0);

            hMailServer.IMAPFolders folders = _application.Settings.PublicFolders;
            hMailServer.IMAPFolder folder = folders.Add("Share");
            folder.Save();

            // Give everyone access to the folder.
            hMailServer.IMAPFolderPermission permission = folder.Permissions.Add();
            permission.PermissionType = hMailServer.eACLPermissionType.ePermissionTypeAnyone;
            permission.set_Permission(hMailServer.eACLPermission.ePermissionLookup, true);
            permission.set_Permission(hMailServer.eACLPermission.ePermissionRead, true);
            permission.set_Permission(hMailServer.eACLPermission.ePermissionInsert, true);
            permission.Save();

            // Add the message to the public folder.
            oSimulator.Connect();
            oSimulator.LogonWithLiteral("*****@*****.**", "test");
            oSimulator.SendSingleCommandWithLiteral("A01 APPEND #Public.Share {4}", "ABCD");

            // Confirm that the message exists in the public folder and not in the inbox.
            Assert.AreEqual(1, oSimulator.GetMessageCount("#Public.Share"));
            Assert.AreEqual(0, oSimulator.GetMessageCount("INBOX"));
            oSimulator.Disconnect();

            // The public directory should now contain the message.
            utilities.AssertFilesInDirectory(publicDir, 1);

            // There users directory should still be empty.
            utilities.AssertFilesInUserDirectory(oAccount, 0);
        }
Пример #45
0
        public void TestAppendFolderNameInOctet()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon("*****@*****.**", "test");
             oSimulator.SelectFolder("INBOX");
             oSimulator.CreateFolder("MONK");
             oSimulator.SendRaw("A01 APPEND {4}\r\n");
             string result = oSimulator.Receive();
             Assert.IsTrue(result.StartsWith("+ Ready for additional command text."));

             oSimulator.SendRaw("MONK (\\Seen) \"20-Jan-2009 12:59:50 +0100\" {5}\r\n");
             result = oSimulator.Receive();
             Assert.IsTrue(result.StartsWith("+ Ready for literal data"));

             oSimulator.SendRaw("WOOOT\r\n");
             result = oSimulator.Receive();

             Assert.AreEqual("A01 OK APPEND completed\r\n", result);
        }
Пример #46
0
        public void TestSearchRange()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();

              ;
              hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

              // Send a message to this account.
              SMTPClientSimulator oSMTP = new SMTPClientSimulator();
              for (int i = 0; i <5 ; i++)
            oSMTP.Send("*****@*****.**", "*****@*****.**", "Test1", "This is a test of IMAP Search");

              IMAPSimulator.AssertMessageCount("*****@*****.**", "test", "INBOX", 5);

              IMAPSimulator oSimulator = new IMAPSimulator();
              string sWelcomeMessage = oSimulator.Connect();
              oSimulator.Logon("*****@*****.**", "test");
              Assert.IsTrue(oSimulator.SelectFolder("INBOX"));

              string result = oSimulator.SendSingleCommand("a01 search 2:4");
              Assert.IsTrue(result.StartsWith("* SEARCH 2 3 4"));

              result = oSimulator.SendSingleCommand("a01 search 3,2");
              Assert.IsTrue(result.StartsWith("* SEARCH 2 3"));

              result = oSimulator.SendSingleCommand("a01 search 3:*");
              Assert.IsTrue(result.StartsWith("* SEARCH 3 4 5"));

              result = oSimulator.SendSingleCommand("a01 search 3,1,3");
              Assert.IsTrue(result.StartsWith("* SEARCH 1 3"));

              result = oSimulator.SendSingleCommand("a01 search 1:*");
              Assert.IsTrue(result.StartsWith("* SEARCH 1 2 3 4 5"));
        }
Пример #47
0
        public void TestSearchUID()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();

             ;
             hMailServer.Account account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             // Send a message to this account.
             SMTPClientSimulator oSMTP = new SMTPClientSimulator();
             for (int i = 0; i < 3; i++)
            oSMTP.Send("*****@*****.**", "*****@*****.**", "Test1", "This is a test of IMAP Search");

             IMAPSimulator.AssertMessageCount("*****@*****.**", "test", "INBOX", 3);

             // There should be 3 UID's, 1,2,3 or similar. No skips in the middle fo them.
             IMAPSimulator oSimulator = new IMAPSimulator();
             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon("*****@*****.**", "test");
             Assert.IsTrue(oSimulator.SelectFolder("INBOX"));

             string result = oSimulator.SendSingleCommand("* UID SEARCH UID 1:*");

             // Potentially, the response is multiline. (UID RESPONSE and an OK line). We only want the first line...
             result = result.Substring(0, result.IndexOf("\r\n"));

             string [] tokens = Microsoft.VisualBasic.Strings.Split(result, " ", -1, Microsoft.VisualBasic.CompareMethod.Text);

             List<int> uids = new List<int>();
             foreach (string token in tokens)
             {
            int temp;
            if (Int32.TryParse(token, out temp))
            {
               uids.Add(temp);
            }
             }

             Assert.AreEqual(3, uids.Count, result);

             Assert.AreEqual(1, uids[0]);
             Assert.AreEqual(2, uids[1]);
             Assert.AreEqual(3, uids[2]);
        }
Пример #48
0
        public void TestSearchWithLiterals()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();

              ;
              hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

              // Send a message to this account.
              SMTPClientSimulator oSMTP = new SMTPClientSimulator();
              oSMTP.Send("*****@*****.**", "*****@*****.**", "Test1", "This is a test of IMAP Search");
              IMAPSimulator.AssertMessageCount("*****@*****.**", "test", "INBOX", 1);
              oSMTP.Send("*****@*****.**", "*****@*****.**", "Test2", "This is a test of IMAP Search");
              IMAPSimulator.AssertMessageCount("*****@*****.**", "test", "INBOX", 2);

              IMAPSimulator oSimulator = new IMAPSimulator();

              string sWelcomeMessage = oSimulator.Connect();
              oSimulator.Logon("*****@*****.**", "test");

              Assert.IsTrue(oSimulator.SelectFolder("INBOX"));

              string result = oSimulator.SendSingleCommandWithLiteral("A01 SEARCH HEADER SUBJECT {5}", "Test1");
              Assert.IsTrue(result.StartsWith("* SEARCH 1\r\n"));

              result = oSimulator.SendSingleCommandWithLiteral("A01 SEARCH HEADER SUBJECT {5}", "Test2");
              Assert.IsTrue(result.StartsWith("* SEARCH 2\r\n"));
        }
Пример #49
0
        public void TestListSpecial()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

              IMAPSimulator oSimulator = new IMAPSimulator();
              string sWelcomeMessage = oSimulator.Connect();
              oSimulator.Logon(oAccount.Address, "test");
              string response = oSimulator.List("");
              Assert.IsTrue(response.StartsWith("* LIST (\\Noselect) \".\" \"\""));
              oSimulator.Disconnect();

              _settings.IMAPHierarchyDelimiter = "/";

              oSimulator = new IMAPSimulator();
              sWelcomeMessage = oSimulator.Connect();
              oSimulator.Logon(oAccount.Address, "test");
              response = oSimulator.List("");
              Assert.IsTrue(response.StartsWith("* LIST (\\Noselect) \"/\" \"\""));
              oSimulator.Disconnect();

              _settings.IMAPHierarchyDelimiter = "\\";

              oSimulator = new IMAPSimulator();
              sWelcomeMessage = oSimulator.Connect();
              oSimulator.Logon(oAccount.Address, "test");
              response = oSimulator.List("", false);
              string expectedResponse = "* LIST (\\Noselect) \"\\\\\" \"\"";
              Assert.IsTrue(response.StartsWith(expectedResponse));
              oSimulator.Disconnect();
        }
Пример #50
0
        public void TestRenameToParallelFolder()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

              IMAPSimulator oSimulator = new IMAPSimulator();

              string sWelcomeMessage = oSimulator.Connect();
              oSimulator.LogonWithLiteral(oAccount.Address, "test");
              Assert.IsTrue(oSimulator.CreateFolder("Main.Sub"));
              Assert.IsTrue(oSimulator.RenameFolder("Main.Sub", "Second.Sub"));

              string listResponse = oSimulator.List();
              Assert.IsFalse(listResponse.Contains("Main.Sub"));
              Assert.IsTrue(listResponse.Contains("Second.Sub"));

              oSimulator.Disconnect();
        }
Пример #51
0
        public void TestRenameToAndFromINBOX()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral(oAccount.Address, "test");
             oSimulator.Send("A01 CREATE A\r\n");
             Assert.IsFalse(oSimulator.RenameFolder("A", "INBOX"));
             Assert.IsFalse(oSimulator.RenameFolder("INBOX", "B"));

             oSimulator.Disconnect();
        }
Пример #52
0
        public void TestRenameLongFolder()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral(oAccount.Address, "test");
             Assert.IsTrue(oSimulator.CreateFolder("1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25"));
             Assert.IsTrue(oSimulator.CreateFolder("A"));

             Assert.IsFalse(oSimulator.RenameFolder("1", "A.1"));
             Assert.IsTrue(oSimulator.RenameFolder("1.2.3", "A.1"));
             Assert.IsTrue(oSimulator.SelectFolder("A.1.4"));

             oSimulator.Disconnect();
        }
Пример #53
0
        public void TestCreateUnnamedSubFolder()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral(oAccount.Address, "test");
             string result = oSimulator.Send("A01 CREATE 1..3");
             Assert.IsTrue(result.Contains("A01 NO"));
             result = oSimulator.Send("A01 CREATE 1....3");
             Assert.IsTrue(result.Contains("A01 NO"));
             result = oSimulator.Send("A01 CREATE 1.......3");
             Assert.IsTrue(result.Contains("A01 NO"));

             oSimulator.Disconnect();
        }
Пример #54
0
        public void TestRenameIncorrectParameters()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral(oAccount.Address, "test");
             string result = oSimulator.Send("A01 CREATE A");

             result = oSimulator.Send("A02 RENAME A B C");
             Assert.IsTrue(result.Contains("A02 BAD"));

             oSimulator.Disconnect();
        }
Пример #55
0
        public void TestLsubInclusion()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

              string folderName = "Folder1";

              IMAPSimulator oSimulator = new IMAPSimulator();
              string sWelcomeMessage = oSimulator.Connect();
              oSimulator.Logon(oAccount.Address, "test");
              Assert.IsTrue(oSimulator.CreateFolder(folderName));
              Assert.IsFalse(oSimulator.LSUB().Contains(folderName));
              Assert.IsTrue(oSimulator.Subscribe(folderName));
              Assert.IsTrue(oSimulator.LSUB().Contains(folderName));

              oSimulator.Disconnect();
        }
Пример #56
0
        public void TestSearchORWithParenthesisSubjectNested()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();

              ;
              hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

              // Send a message to this account.
              SMTPClientSimulator oSMTP = new SMTPClientSimulator();
              oSMTP.Send("*****@*****.**", "*****@*****.**", "Test1", "This is a test of IMAP Search");
              IMAPSimulator.AssertMessageCount("*****@*****.**", "test", "INBOX", 1);
              oSMTP.Send("*****@*****.**", "*****@*****.**", "Test2", "This is a test of IMAP Search");
              IMAPSimulator.AssertMessageCount("*****@*****.**", "test", "INBOX", 2);

              IMAPSimulator oSimulator = new IMAPSimulator();

              string sWelcomeMessage = oSimulator.Connect();
              oSimulator.Logon("*****@*****.**", "test");
              Assert.IsTrue(oSimulator.SelectFolder("INBOX"));

              if (oSimulator.Search("ALL (OR (HEADER SUBJECT \"Test1\") (HEADER SUBJECT \"Test2\"))") != "1 2")
              {
              throw new Exception("ERROR - Search or flag failed");
              }
        }
Пример #57
0
        public void TestSearch()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();

             hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "se'*****@*****.**", "test");

             // Send a message to this account.
             SMTPClientSimulator oSMTP = new SMTPClientSimulator();
             oSMTP.Send(oAccount.Address, oAccount.Address, "Search test", "This is a test of IMAP Search");

             IMAPSimulator.AssertMessageCount(oAccount.Address, "test", "INBOX", 1);

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon(oAccount.Address, "test");
             Assert.IsTrue(oSimulator.SelectFolder("INBOX"));

             oSimulator.SetFlagOnFirstMessage(true, "\\ANSWERED");
             if (oSimulator.Search("ANSWERED") != "1")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(false, "\\ANSWERED");
             if (oSimulator.Search("ANSWERED") != "")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(true, "\\DELETED");
             if (oSimulator.Search("DELETED") != "1")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(false, "\\DELETED");
             if (oSimulator.Search("DELETED") != "")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(true, "\\DRAFT");
             if (oSimulator.Search("DRAFT") != "1")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(false, "\\DRAFT");
             if (oSimulator.Search("DRAFT") != "")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(true, "\\FLAGGED");
             if (oSimulator.Search("FLAGGED  ") != "1")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(false, "\\FLAGGED");
             if (oSimulator.Search("FLAGGED") != "")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(true, "\\SEEN");
             if (oSimulator.Search("SEEN") != "1")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(false, "\\SEEN");
             if (oSimulator.Search("SEEN") != "")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(true, "\\ANSWERED");
             if (oSimulator.Search("UNANSWERED") != "")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(false, "\\ANSWERED");
             if (oSimulator.Search("UNANSWERED") != "1")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(true, "\\DELETED");
             if (oSimulator.Search("UNDELETED") != "")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(false, "\\DELETED");
             if (oSimulator.Search("UNDELETED") != "1")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(true, "\\DRAFT");
             if (oSimulator.Search("UNDRAFT") != "")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(false, "\\DRAFT");
             if (oSimulator.Search("UNDRAFT") != "1")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(true, "\\FLAGGED");
             if (oSimulator.Search("UNFLAGGED") != "")
            throw new Exception("ERROR - Search or flag failed");

             oSimulator.SetFlagOnFirstMessage(false, "\\FLAGGED");
             if (oSimulator.Search("UNFLAGGED") != "1")
            throw new Exception("ERROR - Search or flag failed");

             // SEARCH using LARGER & SMALLER
             if (oSimulator.Search("SMALLER 10") != "")
            throw new Exception("ERROR - Search or flag failed");

             if (oSimulator.Search("SMALLER 10000") != "1")
            throw new Exception("ERROR - Search or flag failed");

             if (oSimulator.Search("LARGER 10") != "1")
            throw new Exception("ERROR - Search or flag failed");

             if (oSimulator.Search("LARGER 10000") != "")
            throw new Exception("ERROR - Search or flag failed");
        }
Пример #58
0
        public void TestCreateLongFolder()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral(oAccount.Address, "test");

             string folderName = "";
             for (int i = 0; i < 255; i++)
            folderName = folderName + "A";

             string result = oSimulator.Send("A01 CREATE " + folderName);
             Assert.IsTrue(result.Contains("A01 OK"));
             Assert.IsTrue(oSimulator.SelectFolder(folderName));

             folderName = "";
             for (int i = 0; i < 256; i++)
            folderName = folderName + "A";

             result = oSimulator.Send("A01 CREATE " + folderName);
             Assert.IsTrue(result.Contains("A01 NO"));
             Assert.IsFalse(oSimulator.SelectFolder(folderName));

             oSimulator.Disconnect();
        }
Пример #59
0
        public void TestRenameToSubFolder()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             IMAPSimulator oSimulator = new IMAPSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral(oAccount.Address, "test");
             Assert.IsTrue(oSimulator.CreateFolder("1.2.3.4.5"));
             Assert.IsTrue(oSimulator.CreateFolder("A"));
             Assert.IsTrue(oSimulator.RenameFolder("1", "A.1"));
             Assert.IsTrue(oSimulator.SelectFolder("A.1"));
             Assert.IsTrue(oSimulator.SelectFolder("A.1.2.3.4.5"));
             Assert.IsTrue(oSimulator.RenameFolder("A.1", "1"));
             Assert.IsFalse(oSimulator.SelectFolder("A.1"));
             Assert.IsFalse(oSimulator.SelectFolder("A.1.2.3.4.5"));
             Assert.IsTrue(oSimulator.SelectFolder("1"));
             Assert.IsTrue(oSimulator.SelectFolder("1.2.3.4.5"));

             oSimulator.Disconnect();
        }
Пример #60
0
        public void TestFolderCaseInLSUB()
        {
            hMailServer.Account oAccount = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

              string folderName = "ABC.def.GHI";

              IMAPSimulator oSimulator = new IMAPSimulator();
              string sWelcomeMessage = oSimulator.Connect();
              oSimulator.Logon(oAccount.Address, "test");
              Assert.IsTrue(oSimulator.CreateFolder(folderName));
              Assert.IsTrue(oSimulator.Subscribe(folderName));
              Assert.IsFalse(oSimulator.LSUB("ABC.DEF.*").Contains("ABC.def.GHI"));
              Assert.IsTrue(oSimulator.LSUB("ABC.DEF.*").Contains("ABC.DEF.GHI"));
              Assert.IsFalse(oSimulator.LSUB("ABC.def.*").Contains("ABC.DEF"));
              Assert.IsTrue(oSimulator.LSUB("ABC.def.*").Contains("ABC.def.GHI"));
              Assert.IsTrue(oSimulator.SelectFolder(folderName));
              oSimulator.Disconnect();
        }