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


C# DnaTestURLRequest.RequestAspxPage方法代码示例

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


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

示例1: Test03RequestHierarchyPage

 public void Test03RequestHierarchyPage()
 {
     Console.WriteLine("Test03RequestHierarchyPage");
     XmlDocument xmldoc = new XmlDocument();
     DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
     try
     {
         request.RequestAspxPage("HierarchyPage.aspx", "_si=actionnetwork&skin=purexml");
         xmldoc.LoadXml(request.GetLastResponseAsString());
     }
     catch (Exception e)
     {
         System.Console.Write(e.Message + request.GetLastResponseAsString());
         //Assert.Fail(e.Message + _asphost.ResponseString);
     }
     Assert.IsNotNull(xmldoc.SelectSingleNode("//HIERARCHYNODES"), "Expected a HIERARCHYNODES XML Tag!!!");
     Assert.AreEqual("16", xmldoc.SelectSingleNode("//HIERARCHYNODES").Attributes["SITEID"].Value, "Incorrect site id in XML");
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:18,代码来源:HierarchyPageTests.cs

示例2: Test04RequestHierarchyPageForSiteWithNoHierarchy

 public void Test04RequestHierarchyPageForSiteWithNoHierarchy()
 {
     Console.WriteLine("Test04RequestHierarchyPageForSiteWithNoHierarchy");
     XmlDocument xmldoc = new XmlDocument();
     DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
     try
     {
         request.RequestAspxPage("HierarchyPage.aspx", "_si=mb606&skin=purexml");
         xmldoc.LoadXml(request.GetLastResponseAsString());
     }
     catch (Exception e)
     {
         System.Console.Write(e.Message + request.GetLastResponseAsString());
         //Assert.Fail(e.Message + _asphost.ResponseString);
     }
     
     Assert.IsNotNull(xmldoc.SelectSingleNode("//ERROR"), "Expected an error tag!!!");
     Assert.AreEqual("nohierarchydata", xmldoc.SelectSingleNode("//ERROR").Attributes["TYPE"].Value, "Make sure the error returned is of type nohierarchydata");
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:19,代码来源:HierarchyPageTests.cs

示例3: Test05RequestHierarchyPageForActionNetwork

 public void Test05RequestHierarchyPageForActionNetwork()
 {
     Console.WriteLine("Test05RequestHierarchyPageForActionNetwork");
     DnaTestURLRequest request = new DnaTestURLRequest("actionnetwork");
     request.RequestAspxPage("HierarchyPage.aspx", @"s_popup=1");
    
     string pageOutput = request.GetLastResponseAsString();
     Assert.IsTrue(pageOutput.Contains("Location"), "Returned page did not contain \"Location\". Returned page:\n" + pageOutput);
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:9,代码来源:HierarchyPageTests.cs

示例4: SignalAndWaitforSiteOptionToBeSet

        /// <summary>
        /// Helper method that signals for a siteoption to be changed then waits for that site to receive and process the signal
        /// </summary>
        /// <param name="siteid">The site id</param>
        /// <param name="section">The site option section</param>
        /// <param name="siteoption">The site option name</param>
        /// <param name="value">The value for the site option</param>
        private static void SignalAndWaitforSiteOptionToBeSet(int siteid, string section, string name, int value)
        {
            // Create a context that will provide us with real data reader support
            IInputContext testContext = DnaMockery.CreateDatabaseInputContext();

            // Now create a datareader to set the Generate Hotlist flag
            using (IDnaDataReader reader = testContext.CreateDnaDataReader("setsiteoption"))
            {
                reader.AddParameter("SiteID", siteid);
                reader.AddParameter("Section", section);
                reader.AddParameter("Name", name);
                reader.AddParameter("Value", value);
                reader.Execute();
            }

            DnaTestURLRequest request = new DnaTestURLRequest("actionnetwork");
            request.SetCurrentUserEditor();
            request.UseEditorAuthentication = true;
            request.RequestAspxPage("dnasignal.aspx", @"action=recache-site&skin=purexml");

            // Now wait untill the .net has been signaled by ripley that we need to recache site data. Site Options are in the data!!!
            // Make sure we've got a drop clause after 15 seconds!!!
            int tries = 0;
            bool updated = false;
            Console.Write("Waiting for signal to be processed ");
            while (tries++ <= 12 && !updated)
            {
                request.RequestPage("siteoptions?skin=purexml");
                if (request.GetLastResponseAsXML().SelectSingleNode("H2G2/SITEOPTIONS[@SITEID='16']/SITEOPTION[NAME='GenerateHotlist']/VALUE") != null)
                {
                    updated = request.GetLastResponseAsXML().SelectSingleNode("H2G2/SITEOPTIONS[@SITEID='16']/SITEOPTION[NAME='GenerateHotlist']/VALUE").InnerXml.CompareTo("1") == 0;

                    if (!updated)
                    {
                        // Goto sleep for 5 secs
                        System.Threading.Thread.Sleep(5000);
                        Console.Write(".");
                    }
                }
            }
            tries *= 5;
            Console.WriteLine(" waited " + tries.ToString() + " seconds.");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:50,代码来源:ArticleSearchPageTests.cs

示例5: Test70ArticleSearchSortByBookmarkCountWhereSiteOptionIncludeBookmarkCountIs0

        public void Test70ArticleSearchSortByBookmarkCountWhereSiteOptionIncludeBookmarkCountIs0()
        {
            Console.WriteLine("Test70ArticleSearchSortByBookmarkCountWhereSiteOptionIncludeBookmarkCountIs0");

            //Changed the database so try a new request object to make sure we get the correct siteoption
            DnaTestURLRequest newRequest = new DnaTestURLRequest("actionnetwork");
            newRequest.RequestAspxPage("ArticleSearchPage.aspx", @"contenttype=-1&showphrases=20&articlesortby=BookmarkCount&skin=purexml");
            Console.WriteLine("After Test70ArticleSearchSortByBookmarkCountWhereSiteOptionIncludeBookmarkCountIs0");

            XmlDocument xml = newRequest.GetLastResponseAsXML();

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/ARTICLESEARCH[@SORTBY='BookmarkCount']") != null, "The @SORTBY element is not BookmarkCount!!!");

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE/BOOKMARKCOUNT") == null, "Element BOOKMARKCOUNT should not be outputted on a site where SiteOption BookmarkCount = 0.");

            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:18,代码来源:ArticleSearchPageTests.cs

示例6: Test69ArticleSearchSortByBookmarkCountWhereSiteOptionIncludeBookmarkCountIs1

        public void Test69ArticleSearchSortByBookmarkCountWhereSiteOptionIncludeBookmarkCountIs1()
        {
            Console.WriteLine("Test69ArticleSearchSortByBookmarkCountWhereSiteOptionIncludeBookmarkCountIs1");

            //Changed the database so try a new request object to make sure we get the correct siteoption
            DnaTestURLRequest newRequest = new DnaTestURLRequest("h2g2"); // SiteOption IncludeBookmarkCount = 1 for h2g2 on SmallGuide
            newRequest.RequestAspxPage("ArticleSearchPage.aspx", @"contenttype=-1&showphrases=20&articlesortby=BookmarkCount&skin=purexml");
            Console.WriteLine("After Test69ArticleSearchSortByBookmarkCountWhereSiteOptionIncludeBookmarkCountIs1");

            XmlDocument xml = newRequest.GetLastResponseAsXML();

            Assert.IsTrue(xml.SelectSingleNode("/H2G2/ARTICLESEARCH[@SORTBY='BookmarkCount']") != null, "The @SORTBY element is not BookmarkCount!!!");

            Assert.IsTrue(Int32.Parse(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE[position()=1]/BOOKMARKCOUNT").FirstChild.Value) > Int32.Parse(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE[position()=2]/BOOKMARKCOUNT").FirstChild.Value), "Articles 1-2 are not in Bookmark count order.");
            Assert.IsTrue(Int32.Parse(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE[position()=2]/BOOKMARKCOUNT").FirstChild.Value) > Int32.Parse(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE[position()=3]/BOOKMARKCOUNT").FirstChild.Value), "Articles 2-3 are not in Bookmark count order.");
            Assert.IsTrue(Int32.Parse(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE[position()=3]/BOOKMARKCOUNT").FirstChild.Value) > Int32.Parse(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE[position()=4]/BOOKMARKCOUNT").FirstChild.Value), "Articles 3-4 are not in Bookmark count order.");
            Assert.IsTrue(Int32.Parse(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE[position()=4]/BOOKMARKCOUNT").FirstChild.Value) > Int32.Parse(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE[position()=5]/BOOKMARKCOUNT").FirstChild.Value), "Articles 4-5 are not in Bookmark count order.");
            Assert.IsTrue(Int32.Parse(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE[position()=5]/BOOKMARKCOUNT").FirstChild.Value) > Int32.Parse(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE[position()=6]/BOOKMARKCOUNT").FirstChild.Value), "Articles 5-6 are not in Bookmark count order.");
            Assert.IsTrue(Int32.Parse(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE[position()=6]/BOOKMARKCOUNT").FirstChild.Value) > Int32.Parse(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE[position()=7]/BOOKMARKCOUNT").FirstChild.Value), "Articles 6-7 are not in Bookmark count order.");
            Assert.IsTrue(Int32.Parse(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE[position()=7]/BOOKMARKCOUNT").FirstChild.Value) > Int32.Parse(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE[position()=8]/BOOKMARKCOUNT").FirstChild.Value), "Articles 7-8 are not in Bookmark count order.");
            Assert.IsTrue(Int32.Parse(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE[position()=8]/BOOKMARKCOUNT").FirstChild.Value) > Int32.Parse(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE[position()=9]/BOOKMARKCOUNT").FirstChild.Value), "Articles 8-9 are not in Bookmark count order.");
            Assert.IsTrue(Int32.Parse(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE[position()=9]/BOOKMARKCOUNT").FirstChild.Value) > Int32.Parse(xml.SelectSingleNode("/H2G2/ARTICLESEARCH/ARTICLES/ARTICLE[position()=10]/BOOKMARKCOUNT").FirstChild.Value), "Articles 9-10 are not in Bookmark count order.");

            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:26,代码来源:ArticleSearchPageTests.cs

示例7: Test68ArticleHotlistShowPhrasesTest

        public void Test68ArticleHotlistShowPhrasesTest()
        {
            Console.WriteLine("Test68ArticleHotlistShowPhrasesTest");

            SignalAndWaitforSiteOptionToBeSet(16, "ArticleSearch", "GenerateHotlist", 1);

            //Changed the database so try a new request object to make sure we get the correct siteoption
            DnaTestURLRequest newRequest = new DnaTestURLRequest("actionnetwork");
            newRequest.RequestAspxPage("ArticleSearchPage.aspx", @"contenttype=-1&showphrases=150&skin=purexml");
            Console.WriteLine("After Test68ArticleHotlistShowPhrasesTest");

            XmlDocument xml = newRequest.GetLastResponseAsXML();

            XmlNode siteoptionset = xml.SelectSingleNode("H2G2/SITE/SITEOPTIONS/SITEOPTION[@GLOBAL='0'][NAME='GenerateHotlist'][VALUE='1']");
            if (siteoptionset == null)
            {
                Console.WriteLine("siteoption not set");
            }

            XmlNode globaloptionset = xml.SelectSingleNode("H2G2/SITE/SITEOPTIONS/SITEOPTION[@GLOBAL='1'][NAME='GenerateHotList'][VALUE='1']");
            if (globaloptionset == null)
            {
                Console.WriteLine("globaloptionset not set");
            }

            Console.WriteLine("HotPhrases");
            XmlNode hotphrases = xml.SelectSingleNode("H2G2/ARTICLEHOT-PHRASES");
            if (hotphrases == null)
            {
                Console.WriteLine("No hotlist");
            }
            else
            {
                Console.WriteLine(hotphrases.InnerXml);
            }

            XmlNode showphrases = xml.SelectSingleNode("H2G2/ARTICLEHOT-PHRASES/@SHOW");
            if (showphrases == null)
            {
                Console.WriteLine("No show");
            }
            else
            {
                Console.WriteLine(showphrases.InnerXml);
            }

            Assert.IsTrue(xml.SelectSingleNode("H2G2/ARTICLEHOT-PHRASES[@SHOW=150]") != null, "The Hotlist show phrases doesn't match the entered value!!!");

            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
            validator.Validate();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:51,代码来源:ArticleSearchPageTests.cs

示例8: Test66FreeTextSearchOnH2G2

        public void Test66FreeTextSearchOnH2G2()
        {
            Console.WriteLine("Test66FreeTextSearchOnH2G2");
            if (CheckFullTextCatalogueExists(@"h2g2"))
            {
                DnaTestURLRequest _h2g2Request = new DnaTestURLRequest("h2g2");

                _h2g2Request.RequestAspxPage("ArticleSearchPage.aspx", @"skip=10&show=10&contenttype=-1&freetextsearch=Test&skin=purexml");

                XmlDocument xml = _h2g2Request.GetLastResponseAsXML();

                Assert.IsTrue(xml.SelectSingleNode("H2G2/ARTICLESEARCH[FREETEXTSEARCH='Test']") != null, "Article Search XML not generated completed - Free Text Search Term!!!");

                DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaUri);
                validator.Validate();
            }
            else
            {
                Console.WriteLine("WARNING!! Test not run as full text indexes are not present!");
            }
            Console.WriteLine("After Test66FreeTextSearchOnH2G2");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:22,代码来源:ArticleSearchPageTests.cs


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