public void UnitTestSubForumEditPostFail()
        {
            SubForum sf = SubForum.create("forum", "subforum");
            User     u  = User.create("user", "password", "*****@*****.**", "q", "a");

            Assert.IsTrue(!sf.editPost(1, "superAdmin", permission.SUPER_ADMIN, "new content").Equals("true"));
            sf.writePost(0, u, "title1", "content1");
            Assert.IsTrue(!sf.editPost(2, "superAdmin", permission.SUPER_ADMIN, "new content").Equals("true"));
            sf.writePost(1, u, "title2", "content2");
            sf.deletePost(2, postDeletionPermission.MODERATOR, permission.SUPER_ADMIN, "superAdmin");
            Assert.IsTrue(!sf.editPost(2, "superAdmin", permission.SUPER_ADMIN, "new content").Equals("true"));
            sf.deletePost(1, postDeletionPermission.MODERATOR, permission.SUPER_ADMIN, "superAdmin");
            Assert.IsTrue(!sf.editPost(1, "superAdmin", permission.SUPER_ADMIN, "new content").Equals("true"));
        }
        public void UnitTestSubForumDeleteReplyFail()
        {
            SubForum sf = SubForum.create("forum", "subforum");
            User     u  = User.create("user", "password", "*****@*****.**", "q", "a");

            sf.writePost(0, u, "title1", "content1");
            sf.writePost(1, u, "title2", "content2");
            sf.writePost(2, u, "title3", "content3");
            Assert.IsTrue(!sf.deletePost(2, postDeletionPermission.WRITER, permission.MEMBER, "user1").Equals("true"));
            Assert.IsTrue(!sf.deletePost(2, postDeletionPermission.MODERATOR, permission.MEMBER, "user").Equals("true"));
            Assert.IsTrue(!sf.deletePost(2, postDeletionPermission.ADMIN, permission.MEMBER, "user").Equals("true"));
            Assert.IsTrue(!sf.deletePost(2, postDeletionPermission.SUPER_ADMIN, permission.MEMBER, "user").Equals("true"));
            Assert.IsTrue(!sf.deletePost(2, postDeletionPermission.INVALID, permission.MEMBER, "user").Equals("true"));
            Assert.IsTrue(sf.getNumOfPOsts() != 1);
            Assert.IsTrue(sf.getNumOfPOsts() == 3);
        }
        public void UnitTestSubForumReplyToDeletedThread()
        {
            SubForum sf = SubForum.create("forum", "subforum");
            User     u  = User.create("user", "password", "*****@*****.**", "q", "a");

            sf.writePost(0, u, "title1", "content1");
            sf.deletePost(1, postDeletionPermission.WRITER, permission.MODERATOR, "user");
            Assert.IsTrue(!sf.writePost(1, u, "title2", "content2").Equals("true"));
        }
        public void UnitTestSubForumCountPosts()
        {
            SubForum sf = SubForum.create("forum", "subforum");
            User     u  = User.create("user", "password", "*****@*****.**", "q", "a");

            sf.writePost(0, u, "title1", "content1");
            sf.writePost(0, u, "title2", "content2");
            sf.writePost(0, u, "title3", "content3");
            sf.writePost(1, u, "title11", "content11");
            sf.writePost(2, u, "title21", "content21");
            sf.writePost(4, u, "title12", "content12");
            sf.writePost(3, u, "title31", "content31");
            Assert.IsTrue(sf.getNumOfPOsts() == 7);
            sf.deletePost(4, postDeletionPermission.WRITER, permission.MODERATOR, "user");
            Assert.IsTrue(sf.getNumOfPOsts() == 5);
            sf.deletePost(2, postDeletionPermission.MODERATOR, permission.MODERATOR, "moderator");
            Assert.IsTrue(sf.getNumOfPOsts() == 3);
        }
        public void UnitTestSubForumDeletePost()
        {
            SubForum sf = SubForum.create("forum", "subforum");
            User     u  = User.create("user", "password", "*****@*****.**", "q", "a");

            sf.writePost(0, u, "title1", "content1");
            sf.writePost(0, u, "title2", "content2");
            sf.writePost(0, u, "title3", "content3");
            sf.writePost(0, u, "title4", "content4");
            sf.writePost(0, u, "title5", "content5");
            sf.writePost(0, u, "title6", "content6");
            Assert.IsTrue(sf.deletePost(1, postDeletionPermission.WRITER, permission.MEMBER, "user").Equals("true"));
            Assert.IsTrue(sf.deletePost(2, postDeletionPermission.WRITER, permission.ADMIN, "user").Equals("true"));
            Assert.IsTrue(sf.deletePost(3, postDeletionPermission.MODERATOR, permission.ADMIN, "user").Equals("true"));
            Assert.IsTrue(sf.deletePost(4, postDeletionPermission.ADMIN, permission.ADMIN, "user").Equals("true"));
            Assert.IsTrue(sf.deletePost(5, postDeletionPermission.SUPER_ADMIN, permission.SUPER_ADMIN, "superAdmin").Equals("true"));
            Assert.IsTrue(sf.deletePost(6, postDeletionPermission.INVALID, permission.SUPER_ADMIN, "superAdmin").Equals("true"));
        }