public void ReadAs_PreModUser() { XmlDocument xml; DnaXmlValidator myValidator; DnaTestURLRequest myRequest = new DnaTestURLRequest(testUtils_ratingsAPI.sitename); string forumId = testUtils_ratingsAPI.makeTestForum(); string ratingId = testUtils_ratingsAPI.makeTestItem(forumId); string url = makeReadPickUrl(forumId); markComment(ratingId); myRequest.SetCurrentUserPreModUser(); try { myRequest.RequestPageWithFullURL(url); } catch { } Assert.IsTrue(myRequest.CurrentWebResponse.StatusCode == HttpStatusCode.OK, "Failed listing editor's picks. Got: " + myRequest.CurrentWebResponse.StatusCode + "\n" + myRequest.CurrentWebResponse.StatusDescription ); xml = myRequest.GetLastResponseAsXML(); myValidator = new DnaXmlValidator(xml.InnerXml, testUtils_ratingsAPI._schemaRatingForum); myValidator.Validate(); }
public void GetCallingUserInfo_AsPreModUser_ReturnsNormalUser() { Console.WriteLine("Before GetCallingUserInfo_AsPreModUser_ReturnsNormalUser"); DnaTestURLRequest request = new DnaTestURLRequest("h2g2"); request.SetCurrentUserPreModUser(); 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("Normal", user.StatusAsString); Console.WriteLine("After GetCallingUserInfo_AsPreModUser_ReturnsNormalUser"); }
public void ReadAs_PreModUser() { XmlDocument xml; DnaXmlValidator myValidator; DnaTestURLRequest myRequest = new DnaTestURLRequest(testUtils_CommentsAPI.sitename); string forumId = testUtils_CommentsAPI.makeTestCommentForum(); string commentID = testUtils_CommentsAPI.makeTestComment(forumId); markComment(commentID); myRequest.SetCurrentUserPreModUser(); // now read it string url = String.Format( "http://{0}/dna/api/comments/CommentsService.svc/V1/site/{1}/commentsforums/{2}/?filterBy=EditorPicks", testUtils_CommentsAPI.server, testUtils_CommentsAPI.sitename, forumId ); try { myRequest.RequestPageWithFullURL(url); } catch { } Assert.IsTrue(myRequest.CurrentWebResponse.StatusCode == HttpStatusCode.OK, "Failed listing editor's picks. Got: " + myRequest.CurrentWebResponse.StatusCode + "\n" + myRequest.CurrentWebResponse.StatusDescription ); xml = myRequest.GetLastResponseAsXML(); myValidator = new DnaXmlValidator(xml.InnerXml, testUtils_CommentsAPI._schemaCommentForum); myValidator.Validate(); }