Microsoft.Protocols.TestSuites.MS_LISTSWS.S02_OperationOnContentType.MSLISTSWS_S02_TC69_UpdateContentTypesXmlDocument_WithGuid_Succeed C# (CSharp) Method

MSLISTSWS_S02_TC69_UpdateContentTypesXmlDocument_WithGuid_Succeed() private method

        public void MSLISTSWS_S02_TC69_UpdateContentTypesXmlDocument_WithGuid_Succeed()
        {
            #region Add a list
            string listName = TestSuiteHelper.GetUniqueListName();

            string listId = TestSuiteHelper.CreateList(listName);

            bool isListCreatedSuccessful = !string.IsNullOrEmpty(listId);
            this.Site.Assert.IsTrue(isListCreatedSuccessful, "Creating list successfully.");

            #endregion Add a list

            #region CreateContentType
            string displayName = TestSuiteHelper.GetUniqueContentTypeName();
            string fieldName = TestSuiteHelper.GetUniqueFieldName();
            List<string> fields = new List<string> { fieldName };

            string contextType = TestSuiteHelper.CreateContentType(listId, displayName, fields);
            this.Site.Assert.IsTrue(!string.IsNullOrEmpty(contextType), "Calling CreateContentType successfully.");
            #endregion CreateContentType

            #region  UpdateContentTypesXmlDocument
            // Construct the newDocument parameter for the invocation below.
            UpdateContentTypesXmlDocumentNewDocument newDocument = new UpdateContentTypesXmlDocumentNewDocument();
            newDocument.ContentTypes = new UpdateContentTypesXmlDocumentNewDocumentContentType[1];
            string qualifiedNameOne = TestSuiteHelper.GetUniqueFieldName();
            string namespaceURIOne = Common.GetConfigurationPropertyValue("ContentTypeXmlNamespaceUri", this.Site);
            string innerXmlOne = Common.GetConfigurationPropertyValue("ValidContentTypeXmlDocument", this.Site);

            newDocument.ContentTypes[0] = new UpdateContentTypesXmlDocumentNewDocumentContentType();
            newDocument.ContentTypes[0].ID = contextType;

            XmlDocument doc = new XmlDocument();

            newDocument.ContentTypes[0].Any = doc.CreateElement(qualifiedNameOne, namespaceURIOne);
            newDocument.ContentTypes[0].Any.InnerXml = innerXmlOne;

            UpdateContentTypesXmlDocumentResponseUpdateContentTypesXmlDocumentResult updateContentTypesXmlDocumentResult
                = this.listswsAdapter.UpdateContentTypesXmlDocument(listId, newDocument);

            // Verify MS-LISTSWS requirement: MS-LISTSWS_R8351.
            // If updating content types XML document is successful, it means implementation does support this UpdateContentTypesXmlDocument method. R8351 can be captured.
            if (Common.IsRequirementEnabled(8351, this.Site))
            {
                Site.CaptureRequirementIfIsNotNull(
                    updateContentTypesXmlDocumentResult,
                    8351,
                    @"Implementation does support this method[UpdateContentTypesXmlDocument]. (Windows SharePoint Services 3.0 and above follow this behavior.)");
            }

            // If protocol SUT returns the response without any Soap Fault, then capture R843
            Site.CaptureRequirementIfIsNotNull(
                updateContentTypesXmlDocumentResult,
                843,
                @"[In UpdateContentTypesXmlDocument operation] If the specified listName is a valid GUID and corresponds to the identification of a list on the site, use that list.");

            #endregion
        }
S02_OperationOnContentType