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


C# DnaTestURLRequest.RequestPageWithFullURL方法代码示例

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


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

示例1: CreateEditorsPick

        public void CreateEditorsPick()
        {
            //First get a comment.
            CommentsTests_V1 comments = new CommentsTests_V1();
            CommentForumTests_V1 commentForums = new CommentForumTests_V1();

            _commentInfo = comments.CreateCommentHelper(commentForums.CommentForumCreateHelper().Id);

            Assert.IsNotNull(_commentInfo, "Unable to Create Comment");
            
            DnaTestURLRequest request = new DnaTestURLRequest(_sitename);
            request.SetCurrentUserEditor();

             // Setup the request url
            string url = String.Format("http://" + _server + "/dna/api/comments/CommentsService.svc/V1/site/{0}/comments/{1}/editorpicks/", _sitename,_commentInfo.ID);
            
            request.RequestPageWithFullURL(url, "No data to send", "text/xml");

            //Check for Editors Pick presence.
            url = String.Format("http://" + _server + "/dna/api/comments/CommentsService.svc/V1/site/{0}/comments/?filterBy=EditorPicks", _sitename);
            request.RequestPageWithFullURL(url);

            XmlDocument xml = request.GetLastResponseAsXML();
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(xml.NameTable);
            nsmgr.AddNamespace("api", "BBC.Dna.Api");
            
            String xPath = String.Format("api:commentsList/api:comments/api:comment[api:id='{0}']", _commentInfo.ID);
            XmlNode pick = xml.SelectSingleNode(xPath, nsmgr);
            Assert.IsNotNull(pick);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:30,代码来源:editorsPicks_v1.cs

示例2: CreateAs_NormalUser

        public void CreateAs_NormalUser()
        {
            XmlDocument xml;
            DnaXmlValidator myValidator;
            DnaTestURLRequest myRequest = new DnaTestURLRequest(testUtils_ratingsAPI.sitename);

            string forumId = testUtils_ratingsAPI.makeTestForum();
            string ratingId = testUtils_ratingsAPI.makeTestItem(forumId);

            string url = makeCreatePickUrl(ratingId);
            string postData = testUtils_ratingsAPI.makeTimeStamp(); // give it some sort of psot so that it uses POST, also see if it is interested in the POST data

            // create the pick

            myRequest.SetCurrentUserNormal();

            try
            {
                myRequest.RequestPageWithFullURL(url, postData, "text/xml");
            }
            catch { }

            Assert.IsTrue(myRequest.CurrentWebResponse.StatusCode == HttpStatusCode.Unauthorized,
                "Should have been unauthorised. Got: " + myRequest.CurrentWebResponse.StatusCode + "\n" + myRequest.CurrentWebResponse.StatusDescription
                );

            xml = myRequest.GetLastResponseAsXML();
            myValidator = new DnaXmlValidator(xml.InnerXml, testUtils_ratingsAPI._schemaError);
            myValidator.Validate();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:30,代码来源:editorsPicksTests_v1.cs

示例3: missTrailingSlash

        public void missTrailingSlash()
        {
            Console.WriteLine("Before missingData - missTrailingSlash");

            // working data
            string id = "";
            string title = "";
            string parentUri = "";
            DnaTestURLRequest request = new DnaTestURLRequest(testUtils_CommentsAPI.sitename);

            // fixed input data

            // test variant data
            string postData = testUtils_CommentsAPI.makePostXml(ref id, ref title, ref parentUri);
            string mimeType = "text/xml";
            string url = "http://" + testUtils_CommentsAPI.server + "/dna/api/comments/CommentsService.svc/v1/site/";
            HttpStatusCode expectedHttpResponse = HttpStatusCode.NotFound;

            request.SetCurrentUserEditor();

            try
            {
                request.RequestPageWithFullURL(url, postData, mimeType);
            }
            catch
            {// Check to make sure that the page returned with the correct information
            }

            Assert.IsTrue(request.CurrentWebResponse.StatusCode == expectedHttpResponse,
                "Expected "+expectedHttpResponse+", got " + request.CurrentWebResponse.StatusCode);

            Console.WriteLine("After missingData - missTrailingSlash");
        } // ends missTrailingSlash
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:33,代码来源:missingData_v1.cs

示例4: NoData

        public void NoData()
        {
            Console.WriteLine("Before missingData - NoData");

            // test variant data
            string postData = "";
            string mimeType = "";
            string url = "http://" + testUtils_CommentsAPI.server + "/dna/api/comments/CommentsService.svc/v1/site/";
            //HttpStatusCode expectedHttpResponse = HttpStatusCode.OK;

            // consistent input data

            // working data
            DnaTestURLRequest request = new DnaTestURLRequest(testUtils_CommentsAPI.sitename);
            request.SetCurrentUserEditor();

            // now get the response - no POST data, nor any clue about the type
            try
            {
                request.RequestPageWithFullURL(url, postData, mimeType);
            }
            catch
            {// Check to make sure that the page returned with the correct information
                Assert.IsTrue(request.CurrentWebResponse.StatusCode == HttpStatusCode.NotFound);
            }
            Console.WriteLine("After missingData - NoData");
        } // ends NoData
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:27,代码来源:missingData_v1.cs

示例5: countForums

        public static int runningForumCount = 0; // used to see our starting count, before we start adding forums.

        /// <summary>
        /// Simply count the number of commentsForums that have been created so far on this site
        /// </summary>
        /// <param name="SiteName">the name of the sute to query</param>
        /// <returns>teh count</returns>
        public static int countForums(string SiteName)
        {
            string _server = DnaTestURLRequest.CurrentServer;

            DnaTestURLRequest request = new DnaTestURLRequest(SiteName);

            request.SetCurrentUserNormal();

            // Setup the request url
            string url = "http://" + _server + "/dna/api/comments/CommentsService.svc/v1/site/" + SiteName + "/";

            // now get the response - no POST data, nor any clue about the input mime-type
            request.RequestPageWithFullURL(url, "", "");

            Assert.IsTrue(request.CurrentWebResponse.StatusCode == HttpStatusCode.OK);

            XmlDocument xml = request.GetLastResponseAsXML();
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _schemaCommentForumList);
            validator.Validate();

            BBC.Dna.Api.CommentForumList returnedList = (BBC.Dna.Api.CommentForumList)StringUtils.DeserializeObject(request.GetLastResponseAsString(), typeof(BBC.Dna.Api.CommentForumList));
            Assert.IsTrue(returnedList != null);

            return returnedList.TotalCount;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:32,代码来源:TestUtils_commentsAPI.cs

示例6: CreateAs_NormalUser

        public void CreateAs_NormalUser()
        {
            XmlDocument xml;
            DnaXmlValidator myValidator;
            DnaTestURLRequest myRequest = new DnaTestURLRequest(testUtils_CommentsAPI.sitename);

            string forumId = testUtils_CommentsAPI.makeTestCommentForum();
            string commentID = testUtils_CommentsAPI.makeTestComment(forumId);

            string url = String.Format(
                "http://{0}/dna/api/comments/CommentsService.svc/V1/site/{1}/comments/{2}/editorpicks/",
                testUtils_CommentsAPI.server, testUtils_CommentsAPI.sitename, commentID
                );
            string postData = testUtils_CommentsAPI.makeTimeStamp(); // give it some sort of psot so that it uses POST, also see if it is interested in the POST data

            // create the pick

            myRequest.SetCurrentUserNormal();

            try
            {
                myRequest.RequestPageWithFullURL(url, postData, "text/xml");
            }
            catch { }

            Assert.IsTrue(myRequest.CurrentWebResponse.StatusCode == HttpStatusCode.Unauthorized,
                "Should have been unauthorised. Got: " + myRequest.CurrentWebResponse.StatusCode + "\n" + myRequest.CurrentWebResponse.StatusDescription
                );

            xml = myRequest.GetLastResponseAsXML();
            myValidator = new DnaXmlValidator(xml.InnerXml, testUtils_CommentsAPI._schemaError);
            myValidator.Validate();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:33,代码来源:editorsPicksTests_v1.cs

示例7: GetForumSource_V1Xml_ReadOnly_Returns404

        public void GetForumSource_V1Xml_ReadOnly_Returns404()
        {
            Console.WriteLine("Before GetForumSource_V1Xml_ReadOnly_Returns404");

            DnaTestURLRequest request = new DnaTestURLRequest(_sitename);
            request.SetCurrentUserNormal();
            request.AssertWebRequestFailure = false;

            string url = String.Format("http://" + _server + "/dna/api/forums/ForumsService.svc/V1/site/{0}/forums/{1}/threads/{2}/forumsource?format=xml", _sitename, 666, 666);

            try
            {
                request.RequestPageWithFullURL(url, null, "text/xml", String.Empty, null);
            }
            catch (WebException)
            {

            }
            Assert.AreEqual(HttpStatusCode.NotFound, request.CurrentWebResponse.StatusCode);
            ErrorData errorData = (ErrorData)StringUtils.DeserializeObject(request.GetLastResponseAsXML().OuterXml, typeof(ErrorData));
            Assert.AreEqual(ErrorType.ForumOrThreadNotFound.ToString(), errorData.Code);

            Console.WriteLine("After GetForumSource_V1Xml_ReadOnly_Returns404");

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

示例8: CreateEditorsPickHelper

        /// <summary>
        /// Helper Function for Tests that require an editors pick.
        /// </summary>
        /// <param name="commentId"></param>
        public void CreateEditorsPickHelper( String siteName, int commentId )
        {
            // Setup the request url
            string url = String.Format("http://" + _server + "/dna/api/comments/CommentsService.svc/V1/site/{0}/comments/{1}/editorpicks/", _sitename, commentId);

            DnaTestURLRequest request = new DnaTestURLRequest(siteName);
            request.SetCurrentUserEditor();
            request.RequestPageWithFullURL(url, "No data to send", "text/xml");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:13,代码来源:editorsPicks_v1.cs

示例9: inXMLoutXML

        public void inXMLoutXML()
        {
            Console.WriteLine("Before formatParamTests - inXMLoutXML");

           // test variant data
            string mimeType = "text/xml";
            string formatParam = "XML";

            HttpStatusCode expectedResponseCode = HttpStatusCode.OK;

            // working data
            string id = "";
            string title = "";
            string parentUri = "";

            // make the post as XML data
            string postData = testUtils_ratingsAPI.makeCreatePostXml_minimal(ref id, ref title, ref parentUri);
            
            string url = testUtils_ratingsAPI.makeCreateForumUrl() + "?format=" + formatParam;

            DnaTestURLRequest request = new DnaTestURLRequest(testUtils_ratingsAPI.sitename);

            request.SetCurrentUserEditor();

            try
            {
                request.RequestPageWithFullURL(url, postData, mimeType);
            }
            catch
            {
                string resp = request.GetLastResponseAsString(); // usefull when debugging
                if (expectedResponseCode == HttpStatusCode.OK)
                    Assert.Fail("Fell over: " + resp); 
            }

            Assert.IsTrue(
                request.CurrentWebResponse.StatusCode == expectedResponseCode, 
                "HTTP repsonse. Expected:" + expectedResponseCode + " actually got " + request.CurrentWebResponse.StatusCode
                );

            XmlDocument xml = request.GetLastResponseAsXML();
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, testUtils_ratingsAPI._schemaRatingForum);
            validator.Validate();

            BBC.Dna.Api.RatingForum returnedForum = 
                (BBC.Dna.Api.RatingForum)StringUtils.DeserializeObject(request.GetLastResponseAsString(), typeof(BBC.Dna.Api.RatingForum)
                );

            Assert.IsTrue(returnedForum.Id == id);
            Assert.IsTrue(returnedForum.Title == title);
            Assert.IsTrue(returnedForum.ParentUri == parentUri);
            Assert.IsTrue(returnedForum.ratingsList.TotalCount == 0);

            Console.WriteLine("After formatParamTests - inXMLoutXML");
        } // ends inXMLoutXML
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:55,代码来源:formatParamTests_v1.cs

示例10: GetCallingUserInfo_AsEditor_ReturnsEditorItemInGroup

        public void GetCallingUserInfo_AsEditor_ReturnsEditorItemInGroup()
        {
            Console.WriteLine("Before GetCallingUserInfo_AsEditor_ReturnsEditorItemInGroup");
            
            DnaTestURLRequest request = new DnaTestURLRequest("h2g2");
            request.SetCurrentUserEditor();
            request.RequestPageWithFullURL(callinguser_url);

            BBC.Dna.Users.User user = (BBC.Dna.Users.User)StringUtils.DeserializeObject(request.GetLastResponseAsXML().OuterXml, typeof(BBC.Dna.Users.User));

            Assert.IsNotNull(user.UsersListOfGroups.Find(x => x.Name.ToLower()  == "editor"));

            Console.WriteLine("After GetCallingUserInfo_AsEditor_ReturnsEditorItemInGroup");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:14,代码来源:users.cs

示例11: GetCallingUserInfo_AsBannedUser_ReturnsBannedStatus

        public void GetCallingUserInfo_AsBannedUser_ReturnsBannedStatus()
        {
            Console.WriteLine("Before GetCallingUserInfo_AsBannedUser_ReturnsBannedStatus");

            DnaTestURLRequest request = new DnaTestURLRequest("h2g2");
            request.SetCurrentUserBanned();
            request.RequestPageWithFullURL(callinguserfull_secure_url);

            BBC.Dna.Users.User user = (BBC.Dna.Users.User)StringUtils.DeserializeObject(request.GetLastResponseAsXML().OuterXml, typeof(BBC.Dna.Users.User));

            Assert.AreEqual("Banned", user.StatusAsString);

            Console.WriteLine("After GetCallingUserInfo_AsBannedUser_ReturnsBannedStatus");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:14,代码来源:users.cs

示例12: InitialiseServer

        public void InitialiseServer()
        {
            SnapshotInitialisation.ForceRestore();
            using (var iis = IIsInitialise.GetIIsInitialise())
            {
                iis.RestartTestSite();
            }

            var request = new DnaTestURLRequest("h2g2");
            //request.RequestPage("status");
            request.RequestPage("status-n");
            request.RequestPageWithFullURL(string.Format("http://{0}/dna/api/comments/status.aspx", DnaTestURLRequest.CurrentServer));

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

示例13: InitialiseServer

        public void InitialiseServer()
        {
            if(_server == "local.bbc.co.uk:8081")
            {
                SnapshotInitialisation.ForceRestore();
                IIsInitialise.GetIIsInitialise().RestartTestSite();
            }


            var request = new DnaTestURLRequest("h2g2");
            //request.RequestPage("status");
            request.RequestPage("status-n");
            request.RequestPageWithFullURL(string.Format("http://{0}/dna/api/comments/status.aspx", DnaTestURLRequest.CurrentServer));

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

示例14: Commentboxusingapi_Readwrite

        public void Commentboxusingapi_Readwrite()
        {

            var testHandler = new StressTestHandler("commentboxusingapi_readwrite", _server, _serverName, _tolerance);
            var uid = "commentboxusingapi_readwrite_loadtest";
            var replace = new Dictionary<string, string> { { "UID", uid } };

            testHandler.InitialiseServer();
            testHandler.MakeReplacements(replace);
            var request = new DnaTestURLRequest("h2g2");
            request.RequestPageWithFullURL(string.Format("http://{0}/dna/h2g2/comments/acsapi?dnauid={1}&dnainitialtitle=TestingCommentBox&dnahostpageurl=http://local.bbc.co.uk/dna/haveyoursay/acs&dnaforumduration=0&skin=purexml", _server, uid));
            testHandler.RunTest();

            Assert.IsFalse(testHandler.DoesRunContainHttpErrors());
            testHandler.CompareResults();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:16,代码来源:LoadTests.cs

示例15: GetForumThreadsXml_ReadOnly_ReturnsValidXml

        public void GetForumThreadsXml_ReadOnly_ReturnsValidXml()
        {
            Console.WriteLine("Before GetForumXml_ReadOnly_ReturnsValidXml");

            DnaTestURLRequest request = new DnaTestURLRequest(_sitename);
            request.SetCurrentUserNormal();
            string url = String.Format("http://" + _server + "/dna/api/forums/ForumsService.svc/V1/site/{0}/forums/{1}/threads/{2}?format=xml", _sitename, 150, 33);
            // now get the response
            request.RequestPageWithFullURL(url, null, "text/xml");
            // Check to make sure that the page returned with the correct information
            XmlDocument xml = request.GetLastResponseAsXML();
            DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml.Replace("xmlns=\"http://schemas.datacontract.org/2004/07/BBC.Dna.Objects\"","") , _schemaForumThreads);
            validator.Validate();

            Console.WriteLine("After GetForumXml_ReadOnly_ReturnsValidXml");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:16,代码来源:forumThreadPosts.cs


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