Example #1
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();
        }
Example #2
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();
        }
        public void TestHierarchyDelimiterLsubResponse()
        {
            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));
             CustomAssert.IsTrue(oSimulator.Subscribe("Test"));
             CustomAssert.IsTrue(oSimulator.Subscribe("Test/Test"));
             string lsubResponse = oSimulator.LSUB();
             CustomAssert.IsTrue(lsubResponse.Contains("\"Test/Test\""));
             CustomAssert.IsTrue(lsubResponse.Contains("\"Test\""));
             oSimulator.Disconnect();
        }
Example #4
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();
        }
Example #5
0
        public void TestUnsubscribe()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             var oSimulator = new IMAPClientSimulator();

             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon("*****@*****.**", "test");
             CustomAssert.IsTrue(oSimulator.CreateFolder("TestFolder1"));
             CustomAssert.IsTrue(oSimulator.CreateFolder("TestFolder2"));

             if (!oSimulator.Subscribe("TestFolder1"))
            CustomAssert.Fail("Subscribe on existent folder failed");
             if (!oSimulator.Subscribe("TestFolder2"))
            CustomAssert.Fail("Subscribe on existent folder failed");

             if (!oSimulator.Unsubscribe("TestFolder1"))
            CustomAssert.Fail("Unsubscribe on existent folder failed");
             if (!oSimulator.Unsubscribe("TestFolder2"))
            CustomAssert.Fail("Unsubscribe on existent folder failed");
        }