當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。