当前位置: 首页>>代码示例>>C#>>正文


C# DnaTestURLRequest.RequestPageWithParamList方法代码示例

本文整理汇总了C#中Tests.DnaTestURLRequest.RequestPageWithParamList方法的典型用法代码示例。如果您正苦于以下问题:C# DnaTestURLRequest.RequestPageWithParamList方法的具体用法?C# DnaTestURLRequest.RequestPageWithParamList怎么用?C# DnaTestURLRequest.RequestPageWithParamList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tests.DnaTestURLRequest的用法示例。


在下文中一共展示了DnaTestURLRequest.RequestPageWithParamList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ArchiveFailedTweets_TweetArchived

        public void ArchiveFailedTweets_TweetArchived()
        {
            ClearModerationQueues();

            var paramList = new DnaTestURLRequest.ParamList();

            // Post three tweets, and collect the param list for the ModeratePost call later
            // It checked that only failed tweets get archived to the "Deleted" tables

            // This one will fail moderation
            PostTweet(CreateTestTweet(64645735745376, "I, Partridge", "76767676", "Alan Partridge", "Ahah!"), ModerationStatus.ForumStatus.PreMod);
            AddLatestPreModPostingToParamList(paramList, ModerationItemStatus.Failed, BBC.Dna.Api.PostStyle.Style.tweet);

            // This one will pass moderation
            PostTweet(CreateTestTweet(64645735745377, "chat suicide", "76767676", "Alan Partridge", "Ahah!"), ModerationStatus.ForumStatus.PreMod);
            AddLatestPreModPostingToParamList(paramList, ModerationItemStatus.Passed, BBC.Dna.Api.PostStyle.Style.tweet);

            // This one will fail moderation, but the post style is not a tweet
            PostTweet(CreateTestTweet(64645735745378, "dormant volcano", "76767676", "Alan Partridge", "Ahah!"), ModerationStatus.ForumStatus.PreMod);
            AddLatestPreModPostingToParamList(paramList, ModerationItemStatus.Failed, BBC.Dna.Api.PostStyle.Style.plaintext);

            // Moderate these posts
            var request = new DnaTestURLRequest(_sitename);
            request.SetCurrentUserEditor();
            request.RequestPageWithParamList("ModeratePosts", paramList);

            using (IDnaDataReader reader = _context.CreateDnaDataReader(""))
            {

                reader.ExecuteDEBUGONLY(@"
                    select * 
                        from PreModPostingsDeleted pmpd
                        join PreModPostingsTweetInfoDeleted pmptid on pmptid.modid=pmpd.modid
                        join ThreadModDeleted tmd on tmd.modid = pmptid.modid
                        where pmpd.reason='A' and pmptid.reason='A' and tmd.reason='A'");
                Assert.IsTrue(reader.Read());
                Assert.AreEqual(64645735745376, reader.GetInt64("tweetid"));
                Assert.AreEqual("I, Partridge", reader.GetString("body"));
                Assert.IsFalse(reader.Read(), "Only expecting one row of archived deleted posts");

                // Check the last two posts are the other two moderated posts
                reader.ExecuteDEBUGONLY(@"
                    select top 2 * 
                        from ThreadEntries te
                        join ThreadEntriesTweetInfo teti on teti.ThreadEntryId=te.EntryId
                        order by te.entryid desc");

                Assert.IsTrue(reader.Read());
                Assert.AreEqual(64645735745378, reader.GetInt64("tweetid"));
                Assert.AreEqual("dormant volcano", reader.GetString("text"));
                Assert.AreEqual(1, reader.GetInt32("Hidden"), "This post failed moderation so should be hidden");

                Assert.IsTrue(reader.Read());
                Assert.AreEqual(64645735745377, reader.GetInt64("tweetid"));
                Assert.AreEqual("chat suicide", reader.GetString("text"));
                Assert.IsFalse(reader.GetNullableInt32("Hidden").HasValue, "The hidden flag should be NULL, i.e. not hidded");
            }

        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:59,代码来源:TwitterTests.cs


注:本文中的Tests.DnaTestURLRequest.RequestPageWithParamList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。