Ejemplo n.º 1
0
        public void ConfirmFileAddedToCorrectAccountFolder()
        {
            TestSetup testSetup  = SingletonProvider <TestSetup> .Instance;
            Account   oAccount   = testSetup.AddAccount(_domain, "*****@*****.**", "test");
            var       oSimulator = new ImapClientSimulator();

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

            CustomAsserts.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.
            CustomAsserts.AssertFilesInDirectory(publicDir, 0);

            // There should be a single file in the users directory.
            CustomAsserts.AssertFilesInUserDirectory(oAccount, 1);
        }
Ejemplo n.º 2
0
        public void ConfirmFileAddedToCorrectPublicFolder()
        {
            TestSetup testSetup  = SingletonProvider <TestSetup> .Instance;
            Account   oAccount   = testSetup.AddAccount(_domain, "*****@*****.**", "test");
            var       oSimulator = new ImapClientSimulator();

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

            CustomAsserts.AssertFilesInDirectory(publicDir, 0);

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

            folder.Save();

            // Give everyone access to the folder.
            IMAPFolderPermission permission = folder.Permissions.Add();

            permission.PermissionType = eACLPermissionType.ePermissionTypeAnyone;
            permission.set_Permission(eACLPermission.ePermissionLookup, true);
            permission.set_Permission(eACLPermission.ePermissionRead, true);
            permission.set_Permission(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.
            CustomAsserts.AssertFilesInDirectory(publicDir, 1);

            // There users directory should still be empty.
            CustomAsserts.AssertFilesInUserDirectory(oAccount, 0);
        }