本文整理汇总了C#中Tests.DnaTestURLRequest.SetCurrentUserAsNewIdentityUser方法的典型用法代码示例。如果您正苦于以下问题:C# DnaTestURLRequest.SetCurrentUserAsNewIdentityUser方法的具体用法?C# DnaTestURLRequest.SetCurrentUserAsNewIdentityUser怎么用?C# DnaTestURLRequest.SetCurrentUserAsNewIdentityUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tests.DnaTestURLRequest
的用法示例。
在下文中一共展示了DnaTestURLRequest.SetCurrentUserAsNewIdentityUser方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SyncUserDetailsViaBBCDna
public void SyncUserDetailsViaBBCDna()
{
DnaTestURLRequest request = new DnaTestURLRequest("identity606");
request.SetCurrentUserAsNewIdentityUser(_userName, _password, _displayName, _email, _dob, TestUserCreator.IdentityPolicies.Adult, "identity606", TestUserCreator.UserType.IdentityOnly);
string cookie = request.CurrentCookie;
request.RequestPage("status-n?skin=purexml");
XmlDocument doc = request.GetLastResponseAsXML();
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/USER/USERNAME"), "User name is not correct");
Assert.AreEqual(_displayName, doc.SelectSingleNode("//VIEWING-USER/USER/USERNAME").InnerText, "User name is not correct");
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/SIGNINNAME"), "login name is not correct");
Assert.AreEqual(_userName, doc.SelectSingleNode("//VIEWING-USER/SIGNINNAME").InnerText, "login name is not correct");
Assert.IsNull(doc.SelectSingleNode("//VIEWING-USER/USER/FIRSTNAME"), "There shouldn't be a first name");
Assert.IsNull(doc.SelectSingleNode("//VIEWING-USER/LASTNAME"), "There shouldn't be a last name");
Thread.Sleep(2000);
Assert.IsTrue(TestUserCreator.SetIdentityAttribute(_userName, cookie, TestUserCreator.AttributeNames.DisplayName, _displayName));
Assert.IsTrue(TestUserCreator.SetIdentityAttribute(_userName, cookie, TestUserCreator.AttributeNames.FirstName, _firstName));
Assert.IsTrue(TestUserCreator.SetIdentityAttribute(_userName, cookie, TestUserCreator.AttributeNames.LastName, _lastName));
Assert.IsTrue(TestUserCreator.SetIdentityAttribute(_userName, cookie, TestUserCreator.AttributeNames.Email, _newEmail));
request.RequestPage("status-n?skin=purexml");
doc = request.GetLastResponseAsXML();
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/USER/USERNAME"), "User name is not correct");
Assert.AreEqual(_displayName, doc.SelectSingleNode("//VIEWING-USER/USER/USERNAME").InnerText, "User name is not correct");
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/SIGNINNAME"), "login name is not correct");
Assert.AreEqual(_userName, doc.SelectSingleNode("//VIEWING-USER/SIGNINNAME").InnerText, "login name is not correct");
}
示例2: CheckCorrectUserDetailsViaBBCDnaWithDisplayName
public void CheckCorrectUserDetailsViaBBCDnaWithDisplayName()
{
DnaTestURLRequest request = new DnaTestURLRequest("identity606");
request.SetCurrentUserAsNewIdentityUser(_userName, _password, _displayName, _email, _dob, TestUserCreator.IdentityPolicies.Adult, "identity606", TestUserCreator.UserType.IdentityOnly);
request.RequestPage("status-n?skin=purexml");
XmlDocument doc = request.GetLastResponseAsXML();
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/USER/USERNAME"), "User name is not correct");
Assert.AreEqual(_displayName, doc.SelectSingleNode("//VIEWING-USER/USER/USERNAME").InnerText, "User name is not correct");
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/SIGNINNAME"), "login name is not correct");
Assert.AreEqual(_userName, doc.SelectSingleNode("//VIEWING-USER/SIGNINNAME").InnerText, "login name is not correct");
}
示例3: CreateCommentForum_CreateCommentAsNonAgreedTermsAndConditionsUser
public void CreateCommentForum_CreateCommentAsNonAgreedTermsAndConditionsUser()
{
Console.WriteLine("Before CreateCommentAsNonAgreedTermsAndConditionsUser");
var request = new DnaTestURLRequest("identity606");
string userName = "CommentForumCreateUser" + DateTime.Now.Ticks;
string userEmail = userName + "@bbc.co.uk";
Assert.IsTrue(
request.SetCurrentUserAsNewIdentityUser(userName, "password", "Comment User", userEmail, "1989-12-31",
TestUserCreator.IdentityPolicies.Adult, "identity606",
TestUserCreator.UserType.SuperUser),
"Failed to create a test identity user");
string id = "FunctiontestCommentForum-" + Guid.NewGuid(); //have to randomize the string to post
string title = "Functiontest Title";
string parentUri = "http://www.bbc.co.uk/dna/h2g2/";
string commentForumXml = String.Format("<commentForum xmlns=\"BBC.Dna.Api\">" +
"<id>{0}</id>" +
"<title>{1}</title>" +
"<parentUri>{2}</parentUri>" +
"</commentForum>", id, title, parentUri);
// Setup the request url
string url = String.Format("http://" + _server + "/dna/api/comments/CommentsService.svc/V1/site/{0}/",
"identity606");
try
{
// now get the response
request.RequestPageWithFullURL(url, commentForumXml, "text/xml");
}
catch
{
}
;
Assert.IsTrue(request.CurrentWebResponse.StatusCode == HttpStatusCode.OK);
userName = "CommentCreateUser" + DateTime.Now.Ticks;
userEmail = userName + "@bbc.co.uk";
//Assert.IsTrue(request.SetCurrentUserAsNewIdentityUser(userName, "password", "Comment User", userEmail, "1989-12-31", TestUserCreator.IdentityPolicies.Adult, true, false, 1, false), "Failed to create a test identity user");
Cookie cookie;
Cookie secureCookie;
string identityUserID;
Assert.IsTrue(TestUserCreator.CreateIdentityUser(userName, "password", "1989-12-31", userEmail,
"Comment User", true,
TestUserCreator.IdentityPolicies.Adult, false, 0,
out cookie,
out secureCookie,
out identityUserID));
request.UseIdentitySignIn = true;
request.CurrentCookie = cookie.Value;
request.CurrentSecureCookie = secureCookie.Value;
string text = "Functiontest Title" + Guid.NewGuid();
commentForumXml = String.Format("<comment xmlns=\"BBC.Dna.Api\">" +
"<text>{0}</text>" +
"</comment>", text);
// Setup the comment request url - needs to be secure
url =
String.Format(
"https://" + _secureServer + "/dna/api/comments/CommentsService.svc/V1/site/{0}/commentsforums/{1}/",
"identity606", id);
try
{
// now get the response
request.RequestPageWithFullURL(url, commentForumXml, "text/xml");
}
catch
{
}
;
Assert.IsTrue(request.CurrentWebResponse.StatusCode == HttpStatusCode.Unauthorized);
// Check to make sure that the page returned with the correct information
XmlDocument xml = request.GetLastResponseAsXML();
var nsmgr = new XmlNamespaceManager(xml.NameTable);
nsmgr.AddNamespace("bda", "BBC.Dna.Api");
Assert.IsNotNull(xml.SelectSingleNode("//bda:error/bda:code", nsmgr), "Failed to find the error code");
Assert.AreEqual("FailedTermsAndConditions", xml.SelectSingleNode("//bda:error/bda:code", nsmgr).InnerText);
Assert.IsNotNull(xml.SelectSingleNode("//bda:error/bda:detail", nsmgr), "Failed to find the error deatils");
Assert.AreEqual("http://identity/policies/dna/adult",
xml.SelectSingleNode("//bda:error/bda:detail", nsmgr).InnerText);
Console.WriteLine("After CreateCommentAsNonAgreedTermsAndConditionsUser");
}
示例4: RatingForumIdentityUserCreate
/// <summary>
/// tests successful RatingForumIdentityUserCreate
/// </summary>
private RatingForum RatingForumIdentityUserCreate(string nameSpace, string id, ModerationStatus.ForumStatus moderationStatus, DateTime closingDate)
{
Console.WriteLine("Before RatingForumIdentityUserCreate");
string identitySitename = "identity606";
DnaTestURLRequest request = new DnaTestURLRequest(identitySitename);
string userName = "RatingForumIdentityUserCreate" + DateTime.Now.Ticks.ToString();
string userEmail = userName + "@bbc.co.uk";
Assert.IsTrue(request.SetCurrentUserAsNewIdentityUser(userName, "password", "RatingForum User", userEmail, "1989-12-31", TestUserCreator.IdentityPolicies.Adult, 1, TestUserCreator.UserType.SuperUser), "Failed to create a test identity user");
//Assert.IsTrue(request.SetCurrentUserAsNewIdentityUser(userName, "password", "RatingForum User", userEmail, "1989-12-31", TestUserCreator.IdentityPolicies.Adult, true, true), "Failed to create a test identity user");
//using (IDnaDataReader reader = DnaMockery.CreateDatabaseInputContext().CreateDnaDataReader(""))
//{
// string sql = "EXEC dbo.createnewuserfromidentityid " + request.CurrentIdentityUserID + ",0,'" + userName + "','" + userEmail + "',74";
// reader.ExecuteDEBUGONLY(sql);
// if (reader.Read())
// {
// int dnauserid = reader.GetInt32NullAsZero("userid");
// sql = "UPDATE dbo.Users SET Status = 2 WHERE UserID = " + dnauserid.ToString();
// reader.ExecuteDEBUGONLY(sql);
// }
//}
string title = "FunctionalTest Title";
string parentUri = "http://www.bbc.co.uk/dna/h2g2/";
string ratingForumXml = String.Format("<ratingForum xmlns=\"BBC.Dna.Api\">" +
"<id>{0}</id>" +
"<namespace>{3}</namespace>" +
"<title>{1}</title>" +
"<parentUri>{2}</parentUri>" +
"<closeDate>{4}</closeDate>" +
"<moderationServiceGroup>{5}</moderationServiceGroup>" +
"</ratingForum>", id, title, parentUri, nameSpace, closingDate.ToString("yyyy-MM-dd"), moderationStatus);
// Setup the request url
string url = String.Format("http://" + _server + "/dna/api/comments/ReviewService.svc/V1/site/{0}/", identitySitename);
// now get the response
request.RequestPageWithFullURL(url, ratingForumXml, "text/xml");
// Check to make sure that the page returned with the correct information
// Check to make sure that the page returned with the correct information
XmlDocument xml = request.GetLastResponseAsXML();
DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _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.ParentUri == parentUri);
Assert.IsTrue(returnedForum.Title == title);
Assert.IsTrue(returnedForum.ModerationServiceGroup == moderationStatus);
Console.WriteLine("After RatingForumIdentityUserCreate");
return returnedForum;
}
示例5: PostToRatingForumAsIdentityUser
private void PostToRatingForumAsIdentityUser(RatingForum ratingForum, DnaTestURLRequest request, string sitename)
{
string text = "Functiontest Title" + Guid.NewGuid().ToString();
string ratingXml = String.Format("<rating xmlns=\"BBC.Dna.Api\">" +
"<text>{0}</text><rating>{1}</rating>" +
"</rating>", text, 5);
// Setup the request url
string url = String.Format("https://" + _secureserver + "/dna/api/comments/ReviewService.svc/V1/site/{0}/reviewforum/{1}/", sitename, ratingForum.Id);
string userName = "RatingForumIdentityUserCreate" + DateTime.Now.Ticks.ToString();
string userEmail = userName + "@bbc.co.uk";
Assert.IsTrue(request.SetCurrentUserAsNewIdentityUser(userName, "password", "RatingForumCommenter", userEmail, "1989-12-31", TestUserCreator.IdentityPolicies.Adult, 1, TestUserCreator.UserType.IdentityOnly), "Failed to create a test identity user");
// now get the response
request.RequestPageWithFullURL(url, ratingXml, "text/xml");
}
示例6: CBBCUDNG_CheckThatDisplayNameMatchesSiteSuffixCausesBlankSiteSuffixXml
public void CBBCUDNG_CheckThatDisplayNameMatchesSiteSuffixCausesBlankSiteSuffixXml()
{
using (IDnaDataReader reader = DnaMockery.CreateDatabaseInputContext().CreateDnaDataReader(""))
{
StringBuilder sql = new StringBuilder("exec setsiteoption 54,'User','UseSiteSuffix','1'");
sql.AppendLine("exec setsiteoption 54,'SignIn','UseIdentitySignIn','1'");
sql.AppendLine("exec setsiteoption 54,'User','AutoGeneratedNames','http://www.stage.bbc.co.uk/udng/'");
sql.AppendLine("UPDATE Sites SET IdentityPolicy='http://identity/policies/dna/kids' WHERE SiteID=54");
reader.ExecuteDEBUGONLY(sql.ToString());
}
DnaTestURLRequest request = new DnaTestURLRequest("mbcbbc");
request.SetCurrentUserAsNewIdentityUser(_userName, _password, _displayName, _email, _14YearsOld, TestUserCreator.IdentityPolicies.Kids, "mbcbbc", TestUserCreator.UserType.IdentityOnly);
string cookie = request.CurrentCookie;
request.RequestPage("dnasignal?action=recache-site&siteid=54&skin=purexml");
XmlDocument doc = request.GetLastResponseAsXML();
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/USER/USERNAME"), "User name is not correct");
Assert.AreEqual(_displayName, doc.SelectSingleNode("//VIEWING-USER/USER/USERNAME").InnerText, "User name is not correct");
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/SIGNINNAME"), "login name is not correct");
Assert.AreEqual(_userName, doc.SelectSingleNode("//VIEWING-USER/SIGNINNAME").InnerText, "login name is not correct");
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/USER/SITESUFFIX"), "Site suffix should not exist!");
Thread.Sleep(5000);
//Set sitesuffix to be same as the username
using (IDnaDataReader reader = DnaMockery.CreateDatabaseInputContext().CreateDnaDataReader(""))
{
StringBuilder sql = new StringBuilder("UPDATE Preferences SET SiteSuffix = '" + _userName + "' WHERE siteid = 54 AND userid = " + request.CurrentUserID.ToString());
reader.ExecuteDEBUGONLY(sql.ToString());
}
//TestUserCreator.SetAppNamedSpacedAttribute(_userName, cookie, "cbbc_displayname", "This Is My SiteSuffix", "cbbc");
request.RequestPage("status-n?skin=purexml");
doc = request.GetLastResponseAsXML();
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/USER/USERNAME"), "User name is not correct");
Assert.AreEqual(_displayName, doc.SelectSingleNode("//VIEWING-USER/USER/USERNAME").InnerText, "User name is not correct");
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/SIGNINNAME"), "login name is not correct");
Assert.AreEqual(_userName, doc.SelectSingleNode("//VIEWING-USER/SIGNINNAME").InnerText, "login name is not correct");
Assert.AreEqual("", doc.SelectSingleNode("//VIEWING-USER/USER/SITESUFFIX").InnerText, "Site suffix should be blank");
}
示例7: CBBCUDNG_SyncAutoGenNameFromIdentityViaRipley_DNASiteSuffixMatchesIdentityValue
public void CBBCUDNG_SyncAutoGenNameFromIdentityViaRipley_DNASiteSuffixMatchesIdentityValue()
{
using (IDnaDataReader reader = DnaMockery.CreateDatabaseInputContext().CreateDnaDataReader(""))
{
StringBuilder sql = new StringBuilder("exec setsiteoption 54,'User','UseSiteSuffix','1'");
sql.AppendLine("exec setsiteoption 54,'SignIn','UseIdentitySignIn','1'");
sql.AppendLine("exec setsiteoption 54,'User','AutoGeneratedNames','http://www.stage.bbc.co.uk/udng/'");
sql.AppendLine("UPDATE Sites SET IdentityPolicy='http://identity/policies/dna/kids' WHERE SiteID=54");
reader.ExecuteDEBUGONLY(sql.ToString());
}
DnaTestURLRequest request = new DnaTestURLRequest("mbcbbc");
request.SetCurrentUserAsNewIdentityUser(_userName, _password, _displayName, _email, _14YearsOld, TestUserCreator.IdentityPolicies.Kids, "mbcbbc", TestUserCreator.UserType.IdentityOnly);
string cookie = request.CurrentCookie;
request.RequestPage("frontpage?skin=purexml");
XmlDocument doc = request.GetLastResponseAsXML();
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/USER/USERNAME"), "User name is not correct");
Assert.AreEqual(_cppDisplayName, doc.SelectSingleNode("//VIEWING-USER/USER/USERNAME").InnerText, "User name is not correct");
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/SIGNINNAME"), "login name is not correct");
Assert.AreEqual(_userName, doc.SelectSingleNode("//VIEWING-USER/SIGNINNAME").InnerText, "login name is not correct");
Assert.IsNull(doc.SelectSingleNode("//VIEWING-USER/USER/FIRSTNAME"), "There shouldn't be a first name");
Assert.IsNull(doc.SelectSingleNode("//VIEWING-USER/USER/LASTNAME"), "There shouldn't be a last name");
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/USER/EMAIL-ADDRESS"), "incorrect email");
Assert.AreEqual(_email, doc.SelectSingleNode("//VIEWING-USER/USER/EMAIL-ADDRESS").InnerText, "incorrect email");
Assert.IsNull(doc.SelectSingleNode("//VIEWING-USER/USER/SITESUFFIX"), "Site suffix should not exist!");
Thread.Sleep(2000);
TestUserCreator.SetAppNamedSpacedAttribute(_userName, cookie, "cbbc_displayname", "This Is My SiteSuffix", "cbbc");
Thread.Sleep(2000);
request.RequestPage("frontpage?skin=purexml");
doc = request.GetLastResponseAsXML();
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/USER/USERNAME"), "User name is not correct");
Assert.AreEqual(_cppDisplayName, doc.SelectSingleNode("//VIEWING-USER/USER/USERNAME").InnerText, "User name is not correct");
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/SIGNINNAME"), "login name is not correct");
Assert.AreEqual(_userName, doc.SelectSingleNode("//VIEWING-USER/SIGNINNAME").InnerText, "login name is not correct");
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/USER/SITESUFFIX"), "Site suffix is not correct");
Assert.AreEqual("This Is My SiteSuffix", doc.SelectSingleNode("//VIEWING-USER/USER/SITESUFFIX").InnerText, "Site suffix is not correct");
}
示例8: CheckCorrectUserDetailsViaRipleyWithDisplayNameAndThenUpdatingDisplayName
public void CheckCorrectUserDetailsViaRipleyWithDisplayNameAndThenUpdatingDisplayName()
{
DnaTestURLRequest request = new DnaTestURLRequest("identity606");
request.SetCurrentUserAsNewIdentityUser(_userName, _password, _displayName, _email, _dob, TestUserCreator.IdentityPolicies.Adult, "identity606", TestUserCreator.UserType.IdentityOnly);
string cookie = request.CurrentCookie;
request.RequestPage("frontpage?skin=purexml");
XmlDocument doc = request.GetLastResponseAsXML();
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/USER/USERNAME"), "User name is not correct");
Assert.AreEqual(_cppDisplayName, doc.SelectSingleNode("//VIEWING-USER/USER/USERNAME").InnerText, "User name is not correct");
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/SIGNINNAME"), "login name is not correct");
Assert.AreEqual(_userName, doc.SelectSingleNode("//VIEWING-USER/SIGNINNAME").InnerText, "login name is not correct");
Thread.Sleep(2000);
string newName = _displayName + " Updated!";
string newNameCPP = _cppDisplayName + " Updated!";
Assert.IsTrue(TestUserCreator.SetIdentityAttribute(_userName, cookie, TestUserCreator.AttributeNames.DisplayName, newName));
request.RequestPage("frontpage?skin=purexml");
doc = request.GetLastResponseAsXML();
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/USER/USERNAME"), "User name is not correct");
Assert.AreEqual(newNameCPP, doc.SelectSingleNode("//VIEWING-USER/USER/USERNAME").InnerText, "User name is not correct");
Assert.IsNotNull(doc.SelectSingleNode("//VIEWING-USER/SIGNINNAME"), "login name is not correct");
Assert.AreEqual(_userName, doc.SelectSingleNode("//VIEWING-USER/SIGNINNAME").InnerText, "login name is not correct");
using (IDnaDataReader reader = DnaMockery.CreateDatabaseInputContext().CreateDnaDataReader(""))
{
string sql = "SELECT * FROM Users WHERE LoginName = '" + _userName + "'";
reader.ExecuteDEBUGONLY(sql);
Assert.IsTrue(reader.Read());
Assert.AreEqual(newName, reader.GetString("username"));
}
}
示例9: GetNewIdentityUser
private static void GetNewIdentityUser(out Cookie cookie, out Cookie secureCookie)
{
DnaTestURLRequest request = new DnaTestURLRequest("h2g2");
string userName = "dnatester";
string password = "123456789";
string dob = "1972-09-07";
string email = "[email protected]";
string testUserName = String.Empty;
// Create a unique name and email for the test
testUserName = userName + DateTime.Now.Ticks.ToString();
email = testUserName + "@bbc.co.uk";
request.SetCurrentUserAsNewIdentityUser(testUserName, password, "", email, dob, TestUserCreator.IdentityPolicies.Adult, "h2g2", TestUserCreator.UserType.IdentityOnly);
string returnedCookie = request.CurrentCookie;
string returnedSecureCookie = request.CurrentSecureCookie;
cookie = new Cookie("IDENTITY", returnedCookie, "/", ".bbc.co.uk");
secureCookie = new Cookie("IDENTITY-HTTPS", returnedSecureCookie, "/", ".bbc.co.uk");
}
示例10: RatingForumIdentityUserCreate
/// <summary>
/// tests successful RatingForumIdentityUserCreate
/// </summary>
private RatingForum RatingForumIdentityUserCreate(string nameSpace, string id, ModerationStatus.ForumStatus moderationStatus, DateTime closingDate)
{
Console.WriteLine("Before RatingForumIdentityUserCreate");
string identitySitename = "identity606";
DnaTestURLRequest request = new DnaTestURLRequest(identitySitename);
string userName = "RatingForumIdentityUserCreate" + DateTime.Now.Ticks.ToString();
string userEmail = userName + "@bbc.co.uk";
Assert.IsTrue(request.SetCurrentUserAsNewIdentityUser(userName, "password", "RatingForum User", userEmail, "1989-12-31", TestUserCreator.IdentityPolicies.Adult, identitySitename, TestUserCreator.UserType.SuperUser), "Failed to create a test identity user");
string title = "FunctionalTest Title";
string parentUri = "http://www.bbc.co.uk/dna/h2g2/";
string ratingForumXml = String.Format("<ratingForum xmlns=\"BBC.Dna.Api\">" +
"<id>{0}</id>" +
"<namespace>{3}</namespace>" +
"<title>{1}</title>" +
"<parentUri>{2}</parentUri>" +
"<closeDate>{4}</closeDate>" +
"<moderationServiceGroup>{5}</moderationServiceGroup>" +
"</ratingForum>", id, title, parentUri, nameSpace, closingDate.ToString("yyyy-MM-dd"), moderationStatus);
// Setup the request url
string url = String.Format("http://" + _server + "/dna/api/comments/ReviewService.svc/V1/site/{0}/", identitySitename);
// now get the response
request.RequestPageWithFullURL(url, ratingForumXml, "text/xml");
// Check to make sure that the page returned with the correct information
// Check to make sure that the page returned with the correct information
XmlDocument xml = request.GetLastResponseAsXML();
DnaXmlValidator validator = new DnaXmlValidator(xml.InnerXml, _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.ParentUri == parentUri);
Assert.IsTrue(returnedForum.Title == title);
Assert.IsTrue(returnedForum.ModerationServiceGroup == moderationStatus);
Console.WriteLine("After RatingForumIdentityUserCreate");
return returnedForum;
}
示例11: CreateIdentityEditorUser
private static string CreateIdentityEditorUser(DnaTestURLRequest request)
{
string userName = "dnatester";
string password = "123456789";
string dob = "1972-09-07";
string email = "[email protected]";
string testUserName = String.Empty;
// Create a unique name and email for the test
testUserName = userName + DateTime.Now.Ticks.ToString();
email = testUserName + "@bbc.co.uk";
request.SetCurrentUserAsNewIdentityUser(testUserName, password, "", email, dob, TestUserCreator.IdentityPolicies.Adult, "haveyoursay", TestUserCreator.UserType.Editor);
return testUserName;
}