示例#1
0
        public void Modify()
        {
            // Ordered by most recent first.  --Kris
            List <Reddit.Things.WikiPageRevision> revisions = Index.Revisions();

            Validate(revisions);
            Assert.IsTrue(revisions.Count > 0);

            // Edit an existing page.  --Kris
            Index = Index.EditAndReturn("Because I can.", "Do not fear the bots.  We are your friends.", revisions[0].Id);

            Validate(Index);

            // Hide and unhide the page.  --Kris
            Index.Hide(revisions[0].Id);
            Index.Hide(revisions[0].Id);

            // Revert to the original page version.  --Kris
            Index = Index.RevertAndReturn(revisions[revisions.Count - 1].Id);

            // Create a new wiki page.  --Kris
            WikiPage myTestPage = Subreddit.Wiki.Page("TestPage" + DateTime.Now.ToString("yyyyMMddHHmmssfffff"))
                                  .CreateAndReturn("Because I have a god complex.", "This is the content of my test page.");

            Validate(myTestPage);

            // Update the permissions.  --Kris
            myTestPage.UpdatePermissions(true, 0);
        }