Esempio n. 1
0
        public void TestCreateFolderWithHash()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             var oSimulator = new IMAPClientSimulator();

             oSimulator.Connect();
             oSimulator.Logon(oAccount.Address, "test");
             CustomAssert.IsFalse(oSimulator.CreateFolder("#Test"));
             CustomAssert.IsTrue(oSimulator.CreateFolder("Test.#Testar"));
             oSimulator.Disconnect();
        }
Esempio n. 2
0
        public void TestIMAPServer()
        {
            TestSetup.DeleteCurrentDefaultLog();

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

             for (int i = 0; i < 30; i++)
             {
            try
            {
               var imapSim = new IMAPClientSimulator(true, 14301);
               imapSim.ConnectAndLogon(account.Address, "test");
               CustomAssert.IsTrue(imapSim.SelectFolder("Inbox"), "SelectInbox");
               imapSim.CreateFolder("Test");
               CustomAssert.IsTrue(imapSim.SelectFolder("Test"), "SelectTest");
               CustomAssert.IsTrue(imapSim.Logout(), "Logout");

               imapSim.Disconnect();
               break;
            }
            catch (Exception)
            {
               if (i == 29)
                  throw;
            }
             }
        }
Esempio n. 3
0
        public void TestCreateFolderWithSlash()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             const string folderName = "ABC\\123";

             var oSimulator = new IMAPClientSimulator();
             oSimulator.Connect();
             oSimulator.Logon(oAccount.Address, "test");
             CustomAssert.IsTrue(oSimulator.CreateFolder(folderName));
             CustomAssert.IsTrue(oSimulator.List().Contains(folderName));
             CustomAssert.IsTrue(oSimulator.SelectFolder(folderName));
             oSimulator.Disconnect();
        }
        public void TestHierarchyDelimiterListResponse()
        {
            Application application = SingletonProvider<TestSetup>.Instance.GetApp();
             Settings settings = _settings;
             settings.IMAPHierarchyDelimiter = "\\";

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

             string folderName = "Test\\Test";

             var oSimulator = new IMAPClientSimulator();
             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon(account.Address, "test");
             CustomAssert.IsTrue(oSimulator.CreateFolder(folderName));
             string listResponse = oSimulator.List();
             CustomAssert.IsTrue(listResponse.Contains("\"Test\\Test\""));
             CustomAssert.IsTrue(listResponse.Contains("\"Test\""));
             oSimulator.Disconnect();
        }
Esempio n. 5
0
        public void TestAppendFolderNameInOctet()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             var oSimulator = new IMAPClientSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon("*****@*****.**", "test");
             oSimulator.SelectFolder("INBOX");
             oSimulator.CreateFolder("MONK");
             oSimulator.SendRaw("A01 APPEND {4}\r\n");
             string result = oSimulator.Receive();
             CustomAssert.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();
             CustomAssert.IsTrue(result.StartsWith("+ Ready for literal data"));

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

             CustomAssert.AreEqual("A01 OK APPEND completed\r\n", result);
        }
Esempio n. 6
0
        public void TestFolderLSUBUnsubscribedFolder()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             const string folderName = "ABC.def.GHI";

             var oSimulator = new IMAPClientSimulator();
             oSimulator.Connect();
             oSimulator.Logon(oAccount.Address, "test");
             CustomAssert.IsTrue(oSimulator.CreateFolder(folderName));
             CustomAssert.IsFalse(oSimulator.LSUB().Contains("\r\n\r\n"));
             oSimulator.Disconnect();
        }
Esempio n. 7
0
        public void TestListCommandChangedHierarchyDelimiter()
        {
            Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");
             _settings.IMAPHierarchyDelimiter = "\\";

             var oSimulator = new IMAPClientSimulator();

             oSimulator.Connect();
             oSimulator.LogonWithLiteral(account.Address, "test");
             oSimulator.CreateFolder("Test\\HelloWorld\\Test2");

             string response = oSimulator.List("%");
             CustomAssert.IsTrue(response.Contains("\"Test\""), response);

             response = oSimulator.List("%\\%");
             CustomAssert.IsTrue(response.Contains("\"Test\\HelloWorld\""), response);

             response = oSimulator.List("%\\%\\%%");
             CustomAssert.IsTrue(response.Contains("\"Test\\HelloWorld\\Test2\""), response);
        }
Esempio n. 8
0
        public void TestSetACLOnAccountFolder()
        {
            Application application = SingletonProvider<TestSetup>.Instance.GetApp();

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

             var oSimulator1 = new IMAPClientSimulator();
             oSimulator1.Connect();
             oSimulator1.LogonWithLiteral(account1.Address, "test");
             CustomAssert.IsTrue(oSimulator1.CreateFolder("SharedFolder"));
             CustomAssert.IsFalse(oSimulator1.SetACL("SharedFolder", account2.Address, "lrswipkxtea"));
             oSimulator1.Disconnect();
        }
Esempio n. 9
0
        public void TestFolderCaseInLSUB()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             string folderName = "ABC.def.GHI";

             var oSimulator = new IMAPClientSimulator();
             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon(oAccount.Address, "test");
             CustomAssert.IsTrue(oSimulator.CreateFolder(folderName));
             CustomAssert.IsTrue(oSimulator.Subscribe(folderName));
             CustomAssert.IsFalse(oSimulator.LSUB("ABC.DEF.*").Contains("ABC.def.GHI"));
             CustomAssert.IsTrue(oSimulator.LSUB("ABC.DEF.*").Contains("ABC.DEF.GHI"));
             CustomAssert.IsFalse(oSimulator.LSUB("ABC.def.*").Contains("ABC.DEF"));
             CustomAssert.IsTrue(oSimulator.LSUB("ABC.def.*").Contains("ABC.def.GHI"));
             CustomAssert.IsTrue(oSimulator.SelectFolder(folderName));
             oSimulator.Disconnect();
        }
Esempio n. 10
0
        public void TestRenameLongFolder()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             var oSimulator = new IMAPClientSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.LogonWithLiteral(oAccount.Address, "test");
             CustomAssert.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"));
             CustomAssert.IsTrue(oSimulator.CreateFolder("A"));

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

             oSimulator.Disconnect();
        }
Esempio n. 11
0
        public void TestRenameToParallelFolder()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             var oSimulator = new IMAPClientSimulator();

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

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

             oSimulator.Disconnect();
        }
Esempio n. 12
0
        public void TestPublicFolderCreateDeep()
        {
            Application application = SingletonProvider<TestSetup>.Instance.GetApp();

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

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

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

             var oSimulator1 = new IMAPClientSimulator();
             oSimulator1.Connect();
             oSimulator1.Logon(account1.Address, "test");
             string folderName = "#Public.Share1.MySub1.MySub2.MySub3.MySub4";
             CustomAssert.IsTrue(oSimulator1.CreateFolder(folderName));

             oSimulator1.Disconnect();
        }
Esempio n. 13
0
        public void TestLsubInclusion()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             string folderName = "Folder1";

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

             oSimulator.Disconnect();
        }
Esempio n. 14
0
        public void TestCreateRootSharedFolder()
        {
            Application application = SingletonProvider<TestSetup>.Instance.GetApp();

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

             var oSimulator1 = new IMAPClientSimulator();
             oSimulator1.Connect();
             oSimulator1.Logon(account1.Address, "test");
             CustomAssert.IsFalse(oSimulator1.CreateFolder("#Public.SharedFolder"));
             oSimulator1.Disconnect();
        }
Esempio n. 15
0
        public void TestDeleteSubFolderCheckAPI()
        {
            Application application = SingletonProvider<TestSetup>.Instance.GetApp();

             IMAPFolders publicFolders = _settings.PublicFolders;

             CustomAssert.AreEqual(0, publicFolders.Count);

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

             IMAPFolder folder = publicFolders.Add("Share1");
             folder.Save();

             CustomAssert.AreEqual(1, publicFolders.Count);

             IMAPFolders mySubFolders = folder.SubFolders;
             CustomAssert.AreEqual(0, mySubFolders.Count);

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

             var oSimulator1 = new IMAPClientSimulator();
             oSimulator1.ConnectAndLogon("*****@*****.**", "test");
             CustomAssert.IsTrue(oSimulator1.CreateFolder("#public.Share1.MySub"));
             CustomAssert.AreEqual(1, mySubFolders.Count);

             permission.set_Permission(eACLPermission.ePermissionDeleteMailbox, true);
             permission.Save();

             CustomAssert.IsTrue(oSimulator1.DeleteFolder("#public.Share1.MySub"));
             CustomAssert.IsFalse(oSimulator1.SelectFolder("#public.Share1.MySub"));

             CustomAssert.AreEqual(0, mySubFolders.Count);
             CustomAssert.AreEqual(1, publicFolders.Count);

             oSimulator1.Disconnect();
        }
Esempio n. 16
0
        public void TestCreateFolderWithSameNameAsPublic()
        {
            Application application = SingletonProvider<TestSetup>.Instance.GetApp();
             string origPublicFolderName = _settings.IMAPPublicFolderName;

             _settings.IMAPPublicFolderName = "MyPublic";

             try
             {
            Account account1 = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**",
                                                                                "test");

            var oSimulator1 = new IMAPClientSimulator();
            oSimulator1.Connect();
            oSimulator1.Logon(account1.Address, "test");
            CustomAssert.IsFalse(oSimulator1.CreateFolder("MyPublic"));
            oSimulator1.Disconnect();
             }
             finally
             {
            _settings.IMAPPublicFolderName = origPublicFolderName;
             }
        }
Esempio n. 17
0
        public void TestSetAclOnPublicFolderNormalUserWithPrivilegies()
        {
            Application application = SingletonProvider<TestSetup>.Instance.GetApp();

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

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

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

             var oSimulator1 = new IMAPClientSimulator();
             oSimulator1.Connect();
             oSimulator1.LogonWithLiteral(account1.Address, "test");
             CustomAssert.IsTrue(oSimulator1.CreateFolder("#Public.Share1.MySub1"));
             oSimulator1.Disconnect();
        }
Esempio n. 18
0
        public void TestSetAclOnPublicFolderNormalUser()
        {
            Application application = SingletonProvider<TestSetup>.Instance.GetApp();

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

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

             var oSimulator1 = new IMAPClientSimulator();
             oSimulator1.Connect();
             oSimulator1.LogonWithLiteral(account1.Address, "test");
             CustomAssert.IsFalse(oSimulator1.CreateFolder("#Public.Share1.MySub1"));
             oSimulator1.Disconnect();
        }
Esempio n. 19
0
        public void TestListWithReference()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             var oSimulator = new IMAPClientSimulator();
             oSimulator.ConnectAndLogon(oAccount.Address, "test");
             oSimulator.CreateFolder("Main.Sub1.Sub2.Sub3");
             oSimulator.CreateFolder("SomeOtherFolder");

             oSimulator.Subscribe("Main");
             oSimulator.Subscribe("Main.Sub1");
             oSimulator.Subscribe("Main.Sub1.Sub2");
             oSimulator.Subscribe("Main.Sub1.Sub2.Sub3");
             oSimulator.Subscribe("SomeOtherFolder");

             string response = oSimulator.List("Main", "*", true);
             CustomAssert.IsFalse(response.Contains("INBOX"));
             CustomAssert.IsFalse(response.Contains("SomeOtherFolder"));
             CustomAssert.IsTrue(response.Contains("* LIST (\\HasChildren) \".\" \"Main.Sub1\""));
             CustomAssert.IsTrue(response.Contains("* LIST (\\HasChildren) \".\" \"Main.Sub1.Sub2\""));
             CustomAssert.IsTrue(response.Contains("* LIST (\\HasNoChildren) \".\" \"Main.Sub1.Sub2.Sub3\""));

             response = oSimulator.List("Main.Sub1", "*", true);
             CustomAssert.IsFalse(response.Contains("INBOX"));
             CustomAssert.IsFalse(response.Contains("SomeOtherFolder"));
             CustomAssert.IsTrue(response.Contains("* LIST (\\HasChildren) \".\" \"Main.Sub1.Sub2\""));
             CustomAssert.IsTrue(response.Contains("* LIST (\\HasNoChildren) \".\" \"Main.Sub1.Sub2.Sub3\""));

             response = oSimulator.LSUB("Main", "*");
             CustomAssert.IsFalse(response.Contains("INBOX"));
             CustomAssert.IsFalse(response.Contains("SomeOtherFolder"));
             CustomAssert.IsTrue(response.Contains("* LSUB (\\HasChildren) \".\" \"Main.Sub1\""));
             CustomAssert.IsTrue(response.Contains("* LSUB (\\HasChildren) \".\" \"Main.Sub1.Sub2\""));
             CustomAssert.IsTrue(response.Contains("* LSUB (\\HasNoChildren) \".\" \"Main.Sub1.Sub2.Sub3\""));

             response = oSimulator.LSUB("Main.Sub1", "*");
             CustomAssert.IsFalse(response.Contains("INBOX"));
             CustomAssert.IsFalse(response.Contains("SomeOtherFolder"));
             CustomAssert.IsTrue(response.Contains("* LSUB (\\HasChildren) \".\" \"Main.Sub1.Sub2\""));
             CustomAssert.IsTrue(response.Contains("* LSUB (\\HasNoChildren) \".\" \"Main.Sub1.Sub2.Sub3\""));

             oSimulator.Disconnect();
        }
Esempio n. 20
0
        public void TestPublicFolderSubscriptionCreate()
        {
            Application application = SingletonProvider<TestSetup>.Instance.GetApp();

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

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

             IMAPFolderPermission permission = folder.Permissions.Add();
             permission.PermissionAccountID = account1.ID;
             permission.PermissionType = eACLPermissionType.ePermissionTypeUser;
             permission.set_Permission(eACLPermission.ePermissionCreate, true);
             permission.set_Permission(eACLPermission.ePermissionAdminister, true);
             permission.set_Permission(eACLPermission.ePermissionExpunge, true);
             permission.set_Permission(eACLPermission.ePermissionDeleteMailbox, true);
             permission.set_Permission(eACLPermission.ePermissionRead, true);
             permission.Save();

             var oSimulator1 = new IMAPClientSimulator();
             oSimulator1.Connect();
             oSimulator1.Logon(account1.Address, "test");
             string folderName = "#Public.Share1.MySub";
             oSimulator1.CreateFolder(folderName);

             IMAPFolder theNewFolder = folder.SubFolders[0];
             CustomAssert.IsTrue(theNewFolder.Name.Equals("MySub"));
             CustomAssert.IsTrue(theNewFolder.Subscribed);

             oSimulator1.Disconnect();
        }
Esempio n. 21
0
        public void TestListWithReferenceTestCase2()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             var oSimulator = new IMAPClientSimulator();
             oSimulator.ConnectAndLogon(oAccount.Address, "test");
             oSimulator.CreateFolder("INBOX.MyApp.SubFolder1");
             oSimulator.CreateFolder("INBOX.MyApp.SubFolder2");
             oSimulator.CreateFolder("INBOX.SomeOtherFolder");

             string response = oSimulator.List("INBOX.MyApp", "%.%", true);
             CustomAssert.IsFalse(response.Contains("\"INBOX.MyApp\""));
             CustomAssert.IsFalse(response.Contains("\"INBOX.SomeOtherFolder\""));
             CustomAssert.IsTrue(response.Contains("* LIST (\\HasNoChildren) \".\" \"INBOX.MyApp.SubFolder1\""));
             CustomAssert.IsTrue(response.Contains("* LIST (\\HasNoChildren) \".\" \"INBOX.MyApp.SubFolder2\""));

             oSimulator.Disconnect();
        }
Esempio n. 22
0
        public void TestRenameFolderToAndFromPublic()
        {
            Application application = SingletonProvider<TestSetup>.Instance.GetApp();

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

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

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

             string oldFolderName = "#Public.Share1";
             string newFolderName = "AccountLevelFolder";

             // Test renaming from local folder name to shared folder.
             var oSimulator1 = new IMAPClientSimulator();
             oSimulator1.Connect();
             oSimulator1.Logon(account1.Address, "test");
             CustomAssert.IsFalse(oSimulator1.RenameFolder(oldFolderName, newFolderName));
             oSimulator1.Disconnect();

             // Test renaming from local folder name to shared folder.
             oldFolderName = "LocalFolder";
             newFolderName = "#Public.Share1";

             oSimulator1 = new IMAPClientSimulator();
             oSimulator1.Connect();
             oSimulator1.Logon(account1.Address, "test");
             oSimulator1.CreateFolder(oldFolderName);
             CustomAssert.IsFalse(oSimulator1.RenameFolder(oldFolderName, newFolderName));
             oSimulator1.Disconnect();
        }
Esempio n. 23
0
        public void TestDelete()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             var oSimulator = new IMAPClientSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon("*****@*****.**", "test");
             CustomAssert.IsFalse(oSimulator.DeleteFolder("DoesNotExist"));
             CustomAssert.IsTrue(oSimulator.CreateFolder("DoesExist"));
             CustomAssert.IsTrue(oSimulator.SelectFolder("DoesExist"));
             oSimulator.Close();
             CustomAssert.IsTrue(oSimulator.DeleteFolder("DoesExist"));
             CustomAssert.IsFalse(oSimulator.SelectFolder("DoesExist"));
        }
Esempio n. 24
0
        public void TestTryCreateInvalidStructure()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             var oSimulator = new IMAPClientSimulator();

             oSimulator.Connect();
             oSimulator.LogonWithLiteral(oAccount.Address, "test");
             CustomAssert.IsTrue(oSimulator.CreateFolder("1.2.3"));
             CustomAssert.IsTrue(oSimulator.CreateFolder("1.2.3.4"));

             // Should fail because name taken.
             CustomAssert.IsFalse(oSimulator.RenameFolder("1.2.3.4", "1.2.3"));
             CustomAssert.IsFalse(oSimulator.RenameFolder("1.2.3.4", "1.2"));
             CustomAssert.IsFalse(oSimulator.RenameFolder("1.2.3.4", "1"));

             // Should fail because invalid destination name.
             CustomAssert.IsFalse(oSimulator.RenameFolder("1.2.3.4", ""));

             // Should fail because destination name taken.
             CustomAssert.IsFalse(oSimulator.RenameFolder("1.2.3", "1.2.3.4"));
             CustomAssert.IsFalse(oSimulator.RenameFolder("1.2", "1.2.3.4"));
             CustomAssert.IsFalse(oSimulator.RenameFolder("1", "1.2.3.4"));

             CustomAssert.IsFalse(oSimulator.RenameFolder("1.2.3", "1.2"));
             CustomAssert.IsFalse(oSimulator.RenameFolder("1.2.3", "1"));

             CustomAssert.IsTrue(oSimulator.RenameFolder("1.2.3", "A"));

             oSimulator.Disconnect();
        }
Esempio n. 25
0
        public void TestRenameSubFolderToMatchingName()
        {
            Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             var oSimulator = new IMAPClientSimulator();
             CustomAssert.IsTrue(oSimulator.ConnectAndLogon(account.Address, "test"));
             CustomAssert.IsTrue(oSimulator.CreateFolder("Folder1"));
             CustomAssert.IsTrue(oSimulator.SelectFolder("Folder1"));

             string result = string.Empty;
             CustomAssert.IsFalse(oSimulator.RenameFolder("Folder1", "Folder1.Sub1", out result));
             CustomAssert.IsTrue(result.Contains("A folder cannot be moved into one of its subfolders."));
             CustomAssert.IsTrue(oSimulator.SelectFolder("Folder1"));

             result = string.Empty;
             CustomAssert.IsTrue(oSimulator.RenameFolder("Folder1", "Folder1Test", out result));
             CustomAssert.IsTrue(oSimulator.SelectFolder("Folder1Test"));

             oSimulator.Disconnect();
        }
Esempio n. 26
0
        public void TestAppendFolderNameInOctetNoFlagList()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             var oSimulator = new IMAPClientSimulator();

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

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

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

             CustomAssert.AreEqual("A01 OK APPEND completed\r\n", result);

             DateTime date = Convert.ToDateTime(oAccount.IMAPFolders.get_ItemByName("MONK").Messages[0].InternalDate);

             CustomAssert.AreEqual(2009, date.Year);
             CustomAssert.AreEqual(12, date.Day);
             CustomAssert.AreEqual(1, date.Month);
        }
Esempio n. 27
0
        public void TestRenameToSubFolder()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             var oSimulator = new IMAPClientSimulator();

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

             oSimulator.Disconnect();
        }
Esempio n. 28
0
        public void TestRenamePublicFolderToRootPublicFolder()
        {
            Application application = SingletonProvider<TestSetup>.Instance.GetApp();

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

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

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

             string oldFolderName = "#Public.Share1.MySub1";
             string newFolderName = "#Public.Share2";

             var oSimulator1 = new IMAPClientSimulator();
             oSimulator1.Connect();
             oSimulator1.Logon(account1.Address, "test");
             CustomAssert.IsTrue(oSimulator1.CreateFolder(oldFolderName));
             CustomAssert.IsFalse(oSimulator1.RenameFolder(oldFolderName, newFolderName));

             CustomAssert.IsTrue(oSimulator1.List().Contains(oldFolderName));
             CustomAssert.IsFalse(oSimulator1.List().Contains(newFolderName));

             oSimulator1.Disconnect();
        }
Esempio n. 29
0
        public void TestExamine()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             var oSimulator = new IMAPClientSimulator();

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

             CustomAssert.IsTrue(result.Contains("[PERMANENTFLAGS ()]"), result);
             CustomAssert.IsTrue(result.Contains("[READ-ONLY]"), result);
        }
Esempio n. 30
0
        public void TestDeleteIMAPFolderNotifications()
        {
            _settings.IMAPIdleEnabled = true;

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

             var oSimulator1 = new IMAPClientSimulator();
             var oSimulator2 = new IMAPClientSimulator();
             oSimulator1.ConnectAndLogon(oAccount.Address, "test");
             oSimulator2.ConnectAndLogon(oAccount.Address, "test");

             oSimulator1.SelectFolder("Inbox");
             oSimulator2.CreateFolder("Mailbox");
             oSimulator2.DeleteFolder("Mailbox");

             SMTPClientSimulator.StaticSend("*****@*****.**", oAccount.Address, "Test", "test");

             POP3ClientSimulator.AssertMessageCount(oAccount.Address, "test", 1);

             string noopResponse = oSimulator1.NOOP() + oSimulator1.NOOP();

             // confirm that the client is notified about this message even though another
             // folder has been dropped by another client.
             CustomAssert.IsTrue(noopResponse.Contains(@"* 1 EXISTS"), noopResponse);
        }