Example #1
0
        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 IMAPSimulator();
             string sWelcomeMessage = oSimulator.Connect();
             oSimulator.Logon(account.Address, "test");
             Assert.IsTrue(oSimulator.CreateFolder(folderName));
             Assert.IsTrue(oSimulator.Subscribe("Test"));
             Assert.IsTrue(oSimulator.Subscribe("Test/Test"));
             string lsubResponse = oSimulator.LSUB();
             Assert.IsTrue(lsubResponse.Contains("\"Test/Test\""));
             Assert.IsTrue(lsubResponse.Contains("\"Test\""));
             oSimulator.Disconnect();
        }
Example #2
0
        public void TestLsubInclusion()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             string folderName = "Folder1";

             var oSimulator = new IMAPSimulator();
             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 #3
0
        public void TestListWithReference()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             var oSimulator = new IMAPSimulator();
             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();
        }
Example #4
0
        public void TestFolderCaseInLSUB()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             string folderName = "ABC.def.GHI";

             var oSimulator = new IMAPSimulator();
             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 IMAPSimulator();

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

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

             if (!oSimulator.Unsubscribe("TestFolder1"))
            Assert.Fail("Unsubscribe on existent folder failed");
             if (!oSimulator.Unsubscribe("TestFolder2"))
            Assert.Fail("Unsubscribe on existent folder failed");
        }
Example #6
0
        public void TestFolderQuote()
        {
            Account oAccount = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");

             const string folderName = "Test*";

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