public void MSLISTSWS_S02_TC19_DeleteContentTypeXmlDocument_Succeed()
{
#region Add a list
// Add a new list to the server.
string listId = TestSuiteHelper.CreateList();
bool isListCreatedSuccessfully = !string.IsNullOrEmpty(listId);
this.Site.Assert.IsTrue(isListCreatedSuccessfully, "Test suite should create the list successfully.");
#endregion Add a list
#region CreateContentType
// Create a contentType
string displayName = TestSuiteHelper.GetUniqueContentTypeName();
List<string> fieldNames = new List<string>();
string fieldsName = Common.GetConfigurationPropertyValue("ListFieldText", this.Site);
fieldNames.Add(fieldsName);
bool createContentTypeSucceeded = false;
string contentType = TestSuiteHelper.CreateContentType(listId, displayName, fieldNames);
createContentTypeSucceeded = !string.IsNullOrEmpty(contentType);
this.Site.Assert.IsTrue(createContentTypeSucceeded, "CreateContentType Should succeed.");
#endregion CreateContentType
#region UpdateContentTypeXMLDocument
string elementName = Common.GetConfigurationPropertyValue("ContentTypeXmlQualifiedName", this.Site);
string nameSpaceUri = Common.GetConfigurationPropertyValue("ContentTypeXmlNamespaceUri", this.Site);
string innnerXml = Common.GetConfigurationPropertyValue("ValidContentTypeXmlDocument", this.Site);
System.Xml.XmlNode newDocument = TestSuiteHelper.CreateNewDocument(elementName, nameSpaceUri, innnerXml);
bool isNewDocumentCreatedSuccessfully = !string.IsNullOrEmpty(newDocument.ToString());
this.Site.Assert.IsTrue(isNewDocumentCreatedSuccessfully, "New document should be created successfully.");
// Update the XmlDocument
System.Xml.XPath.IXPathNavigable updateResult = this.listswsAdapter.UpdateContentTypeXmlDocument(listId, contentType, newDocument);
this.Site.Assert.IsNotNull(updateResult, "UpdateContentTypeXmlDocument operation should succeed.");
#endregion
#region DeleteContentTypeXmlDocument
DeleteContentTypeXmlDocumentResponseDeleteContentTypeXmlDocumentResult deleteResult = this.listswsAdapter.DeleteContentTypeXmlDocument(listId, contentType, nameSpaceUri);
// Verify requirement R4971.
// If delete is successful, it means implementation does support this DeleteContentTypeXmlDocument method. R4971 can be captured.
if (Common.IsRequirementEnabled(4971, this.Site))
{
Site.CaptureRequirementIfIsNotNull(
deleteResult.Success,
4971,
@"Implementation does support this method[DeleteContentTypeXmlDocument]. (Windows SharePoint Services 3.0 and above follow this behavior.)");
}
// If the DeleteContentTypeXmlDocument succeed, then capture R502 and R508.
Site.CaptureRequirementIfIsNotNull(
deleteResult.Success,
502,
@"[In DeleteContentTypeXmlDocument operation] If the specified listName is a valid GUID and corresponds to the identification of a list on the site, use that list.");
Site.CaptureRequirementIfIsNotNull(
deleteResult,
508,
@"[In DeleteContentTypeXmlDocument operation] If no SOAP fault has been thrown, the protocol server MUST respond with DeleteContentTypeXmlDocumentResult.");
#endregion DeleteContentTypeXmlDocument
}