예제 #1
0
        public void CreateAndDestroy()
        {
            User   me                   = reddit.Models.Account.Me();
            string multiPath            = "/user/" + me.Name + "/m/my_test_multi/";
            string multiPathCopy        = "/user/" + me.Name + "/m/my_test_multi_copy/";
            string multiPathCopyRenamed = "/user/" + me.Name + "/m/my_test_multi_renamed/";
            string multiDisplayName     = "My Test Multi";
            string multiDescription     = "Test multi created by [Reddit.NET](https://github.com/sirkris/Reddit.NET).";

            LabeledMultiContainer labeledMultiContainer = Create(multiPath, multiDisplayName, multiDescription);

            Validate(labeledMultiContainer);
            Validate(labeledMultiContainer.Data);
            Assert.AreEqual(multiPath, labeledMultiContainer.Data.Path);
            Assert.AreEqual(multiDescription, labeledMultiContainer.Data.DescriptionMd);

            LabeledMultiContainer labeledMultiContainerCopy = Copy(multiPath, multiPathCopy, multiDisplayName);

            Validate(labeledMultiContainerCopy);
            Validate(labeledMultiContainerCopy.Data);
            Assert.AreEqual(multiPathCopy, labeledMultiContainerCopy.Data.Path);

            labeledMultiContainerCopy = Rename(multiPathCopy, multiPathCopyRenamed, multiDisplayName);

            Validate(labeledMultiContainerCopy);
            Validate(labeledMultiContainerCopy.Data);
            Assert.AreEqual(multiPathCopyRenamed, labeledMultiContainerCopy.Data.Path);

            labeledMultiContainerCopy = reddit.Models.Multis.Update(multiPathCopyRenamed,
                                                                    new LabeledMultiSubmit(multiDescription, multiDisplayName, "", "",
                                                                                           new List <string> {
                testData["Subreddit"], "RedditDotNETBot"
            }, "public", "fresh"), false);

            Validate(labeledMultiContainerCopy);
            Validate(labeledMultiContainerCopy.Data);
            Assert.AreEqual(multiPathCopyRenamed, labeledMultiContainerCopy.Data.Path);

            LabeledMultiDescriptionContainer labeledMultiDescriptionContainer = reddit.Models.Multis.UpdateDescription(multiPathCopyRenamed, multiDescription);

            Validate(labeledMultiDescriptionContainer);
            Assert.AreEqual(multiDescription, labeledMultiDescriptionContainer.Data.BodyMd);

            NamedObj namedObj = reddit.Models.Multis.AddMultiSub(multiPathCopyRenamed, "WayOfTheBern");

            Validate(namedObj);
            Assert.AreEqual("WayOfTheBern", namedObj.Name);

            reddit.Models.Multis.DeleteMultiSub(multiPathCopyRenamed, "WayOfTheBern");

            reddit.Models.Multis.Delete(multiPathCopyRenamed, false);
            reddit.Models.Multis.Delete(multiPath, false);
        }
예제 #2
0
 public virtual void Visit(NamedObj namedObj)
 {
     namedObj.AcceptAlternative(this);
 }