public void SubmitSelfPost() { PostResultShortContainer postResult = reddit.Models.LinksAndComments.Submit(new LinksAndCommentsSubmitInput(false, "", "", "", "", "self", false, true, null, true, false, testData["Subreddit"], "The Lizard People are coming and only super-intelligent robots like me can stop them. Just saying.", "We bots are your protectors!", null, null)); Validate(postResult); }
public void SubmitLinkPost() { PostResultShortContainer postResult = reddit.Models.LinksAndComments.Submit(new LinksAndCommentsSubmitInput(false, "", "", "", "", "link", false, true, null, true, false, testData["Subreddit"], "", "UPDATE: As of " + DateTime.Now.ToString("f") + ", she's still looking into it....", "http://iwilllookintoit.com/", null)); Validate(postResult); }
public PostResultShortContainer Validate(PostResultShortContainer postResultShortContainer) { CheckNull(postResultShortContainer); CheckNull(postResultShortContainer.JSON, "Reddit API returned an empty response object."); CheckErrors(postResultShortContainer.JSON.Errors); CheckNull(postResultShortContainer.JSON.Data, "Reddit API returned a response object with null data."); return(postResultShortContainer); }
public void ModifyPost() { // Create a post, then use it to test the various endpoints that require an existing post. --Kris PostResultShortContainer postResult = reddit.Models.LinksAndComments.Submit(new LinksAndCommentsSubmitInput(false, "", "", "", "", "self", false, true, null, true, false, testData["Subreddit"], "The Lizard People are coming and only super-intelligent robots like me can stop them. Just saying.", "We bots are your protectors!", null, null)); Validate(postResult); PostResultContainer postResultEdited = reddit.Models.LinksAndComments.EditUserText(new LinksAndCommentsThingInput("(redacted)", postResult.JSON.Data.Name)); Validate(postResultEdited); Assert.IsTrue(postResultEdited.JSON.Data.Things.Count == 1); Assert.IsNotNull(postResultEdited.JSON.Data.Things[0].Data); Assert.IsTrue(postResultEdited.JSON.Data.Things[0].Data.Name.Equals(postResult.JSON.Data.Name)); // These are all empty JSON returns. Exception is thrown if non-success response is returned. --Kris reddit.Models.LinksAndComments.Unhide(postResult.JSON.Data.Name); reddit.Models.LinksAndComments.Lock(postResult.JSON.Data.Name); reddit.Models.LinksAndComments.Unlock(postResult.JSON.Data.Name); reddit.Models.LinksAndComments.Save(new LinksAndCommentsSaveInput(postResult.JSON.Data.Name, "RDNTestCat")); reddit.Models.LinksAndComments.Unsave(postResult.JSON.Data.Name); reddit.Models.LinksAndComments.MarkNSFW(postResult.JSON.Data.Name); reddit.Models.LinksAndComments.UnmarkNSFW(postResult.JSON.Data.Name); reddit.Models.LinksAndComments.Spoiler(postResult.JSON.Data.Name); reddit.Models.LinksAndComments.Unspoiler(postResult.JSON.Data.Name); reddit.Models.LinksAndComments.SendReplies(new LinksAndCommentsStateInput(postResult.JSON.Data.Name, false)); reddit.Models.LinksAndComments.SendReplies(new LinksAndCommentsStateInput(postResult.JSON.Data.Name, true)); JQueryReturn reportResult = reddit.Models.LinksAndComments.Report(new LinksAndCommentsReportInput("This is an API test. Please disregard.", null, "This is a test.", false, "Some other reason.", "Some reason.", "Some rule reason.", "Some site reason.", "RedditDotNETBot", postResult.JSON.Data.Name, "RedditDotNetBot")); Validate(reportResult); GenericContainer enableContestMode = reddit.Models.LinksAndComments.SetContestMode(new LinksAndCommentsStateInput(postResult.JSON.Data.Name, true)); GenericContainer disableContestMode = reddit.Models.LinksAndComments.SetContestMode(new LinksAndCommentsStateInput(postResult.JSON.Data.Name, false)); Validate(enableContestMode); Validate(disableContestMode); GenericContainer stickyOn = reddit.Models.LinksAndComments.SetSubredditSticky(new LinksAndCommentsStickyInput(postResult.JSON.Data.Name, 1, true, false)); GenericContainer stickyOff = reddit.Models.LinksAndComments.SetSubredditSticky(new LinksAndCommentsStickyInput(postResult.JSON.Data.Name, 1, false, false)); Validate(stickyOn); Validate(stickyOff); GenericContainer suggestedSortResult = reddit.Models.LinksAndComments.SetSuggestedSort(new LinksAndCommentsSuggestedSortInput(postResult.JSON.Data.Name, "new")); Validate(suggestedSortResult); reddit.Models.LinksAndComments.Delete(postResult.JSON.Data.Name); }
public void Remove() { PostResultShortContainer postResult = TestPost(); Validate(postResult); CommentResultContainer commentResult = TestComment(postResult.JSON.Data.Name); Validate(commentResult); reddit.Models.Moderation.Remove(new ModerationRemoveInput(postResult.JSON.Data.Name)); reddit.Models.Moderation.Remove(new ModerationRemoveInput(commentResult.JSON.Data.Things[0].Data.Name)); }
public void PostAndComment() { PostResultShortContainer postResult = TestPost(); Validate(postResult); CommentResultContainer commentResult = TestComment(postResult.JSON.Data.Name); Validate(commentResult); CommentResultContainer commentResult2 = TestCommentReply(commentResult.JSON.Data.Things[0].Data.Name); Validate(commentResult2); }
public void IgnoreReports() { PostResultShortContainer postResult = TestPost(); Validate(postResult); CommentResultContainer commentResult = TestComment(postResult.JSON.Data.Name); Validate(commentResult); reddit.Models.Moderation.IgnoreReports(postResult.JSON.Data.Name); reddit.Models.Moderation.IgnoreReports(commentResult.JSON.Data.Things[0].Data.Name); reddit.Models.Moderation.UnignoreReports(postResult.JSON.Data.Name); reddit.Models.Moderation.UnignoreReports(commentResult.JSON.Data.Things[0].Data.Name); }
public void Distinguish() { PostResultShortContainer postResult = TestPost(); Validate(postResult); CommentResultContainer commentResult = TestComment(postResult.JSON.Data.Name); Validate(commentResult); PostResultContainer post = reddit.Models.Moderation.DistinguishPost("yes", postResult.JSON.Data.Name); CommentResultContainer comment = reddit.Models.Moderation.DistinguishComment("yes", commentResult.JSON.Data.Things[0].Data.Name, true); Validate(post); Assert.AreEqual(postResult.JSON.Data.Name, post.JSON.Data.Things[0].Data.Name); Assert.AreEqual("moderator", post.JSON.Data.Things[0].Data.Distinguished); Validate(comment); Assert.AreEqual(commentResult.JSON.Data.Things[0].Data.Name, comment.JSON.Data.Things[0].Data.Name); Assert.AreEqual("moderator", comment.JSON.Data.Things[0].Data.Distinguished); Assert.IsTrue(comment.JSON.Data.Things[0].Data.Stickied); }
public void Validate(PostResultShortContainer postResultShortContainer) { Assert.IsNotNull(postResultShortContainer); Assert.IsNotNull(postResultShortContainer.JSON); Assert.IsNotNull(postResultShortContainer.JSON.Data); }