コード例 #1
0
        public void MSLISTSWS_S02_TC70_UpdateContentTypesXmlDocument_WithListTitle_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(listName, newDocument);

            Site.CaptureRequirementIfIsNotNull(
                updateContentTypesXmlDocumentResult,
                857,
                @"[In UpdateContentTypesXmlDocument operation] [In UpdateContentTypesXmlDocumentResponse element] [In UpdateContentTypesXmlDocumentResult element] If no error conditions cause the protocol server to return a SOAP fault, an UpdateContentTypesXmlDocumentResult MUST be returned.");

            // If the list whose list title corresponds to the specified listName exists and it is updated successfully, the server will return a successful response.
            // So if the response of the operation isn't null, then capture R844, R845, R848 and R2278.
            Site.CaptureRequirementIfIsNotNull(
                updateContentTypesXmlDocumentResult,
                844,
                @"[In UpdateContentTypesXmlDocument operation] If the specified listName is not a valid GUID, check if the listName corresponds to the list title of a list on the site and, if so, use that list.");

            Site.CaptureRequirementIfIsNotNull(
                updateContentTypesXmlDocumentResult,
                845,
                @"[In UpdateContentTypesXmlDocument operation] If the specified listName does not correspond to the identification of a list on the site, check if the listName corresponds to the list title of a list on the site and, if so, use that list.");

            Site.CaptureRequirementIfIsNotNull(
                updateContentTypesXmlDocumentResult,
                848,
                @"[In UpdateContentTypesXmlDocument operation] Otherwise [If the newDocument follows the schema, the content type specified by the ContentType.ID attribute contains child elements, the specified listName corresponds to the identification or the list title of a list on the site and there is no XML document with the same namespace URI exist], the new XML Document MUST be added to the XML document collection that the content type specified by the ContentType.ID attribute.");

            Site.CaptureRequirementIfIsNotNull(
                updateContentTypesXmlDocumentResult,
                2278,
                @"[In UpdateContentTypesXmlDocument operation] Otherwise [If the newDocument follows the schema, the content type specified by the ContentType.ID attribute contains child elements, the specified listName corresponds to the identification or the list title of a list on the site and there is no XML document with the same namespace URI exist] the protocol server MUST return a success UpdateContentTypesXmlDocumentResult.");

            #endregion
        }
コード例 #2
0
        /// <summary>
        /// The UpdateContentTypesXmlDocument operation is used to update XML Document properties of the content type collection on a list.
        /// </summary>
        /// <param name="listName">The name of the list of which some content type xml documents will be updated</param>
        /// <param name="newDocument">The container element for a list of content type and XML document to update</param>
        /// <returns>UpdateContentTypesXmlDocument Result</returns>
        public UpdateContentTypesXmlDocumentResponseUpdateContentTypesXmlDocumentResult UpdateContentTypesXmlDocument(string listName, UpdateContentTypesXmlDocumentNewDocument newDocument)
        {
            this.Site.Assert.IsNotNull(this.listsProxy, "The Proxy instance should not be NULL. If assert failed, the adapter need to be initialized");

            UpdateContentTypesXmlDocumentResponseUpdateContentTypesXmlDocumentResult result = null;
            try
            {
                result = this.listsProxy.UpdateContentTypesXmlDocument(listName, newDocument);

                // Verify the requirements of the UpdateContentTypesXmlDocument operation.
                this.VerifyUpdateContentTypesXmlDocumentOperation(result);

                // Verify the requirements of the transport.
                this.VerifyTransportRequirements();
            }
            catch (XmlSchemaValidationException exp)
            {
                // Log the errors and warnings
                this.LogSchemaValidationErrors();

                this.Site.Assert.Fail(exp.Message);
            }
            catch (SoapException)
            {
                this.VerifySoapExceptionFault();
                throw;
            }

            return result;
        }
コード例 #3
0
        public void MSLISTSWS_S02_TC68_UpdateContentTypesXmlDocument_IncorrectListName()
        {
            Site.Assume.IsTrue(
                Common.IsRequirementEnabled(2767, this.Site) || Common.IsRequirementEnabled(2499, this.Site),
                @"Test is executed only when R2767Enabled is set to true or R2499Enabled is set to true.");

            #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;

            string invalidList = TestSuiteHelper.GetInvalidGuidAndNocorrespondString();
            bool issoapFaultGenerated = false;
            string errorCode = string.Empty;
            string errorString = string.Empty;
            try
            {
                this.listswsAdapter.UpdateContentTypesXmlDocument(invalidList, newDocument);

                Site.Assert.Fail("Calling UpdateContentType should fail");
            }
            catch (SoapException exp)
            {
                issoapFaultGenerated = true;
                errorCode = TestSuiteHelper.GetErrorCode(exp);
                errorString = TestSuiteHelper.GetErrorString(exp);
            }

            this.Site.Assert.IsTrue(issoapFaultGenerated, "There should be a soap fault generated when call UpdateContentTypesXmlDocument operation with invalidListName");

            if (Common.IsRequirementEnabled(2767, this.Site))
            {
                this.Site.Log.Add(
                        LogEntryKind.Debug,
                        "The actual value:errorCode[{0}] for requirement #R2767 #R2011",
                        string.IsNullOrEmpty(errorCode) ? "NullOrEmpty" : errorCode);

                Site.CaptureRequirementIfIsTrue(
                    "0x82000006".Equals(errorCode, StringComparison.OrdinalIgnoreCase),
                    2767,
                    @"[In UpdateContentTypesXmlDocument operation] Implementation does return a SOAP fault with error code 0x82000006, if the list specified by the listName is not found. (SharePoint Foundation 2010 and above follow this behavior.)");

                Site.CaptureRequirementIfIsTrue(
                        "0x82000006".Equals(errorCode, StringComparison.OrdinalIgnoreCase),
                      2011,
                      @"[In UpdateContentTypesXmlDocument operation] [If the list specified by the listName is not found, the protocol server should<74> return a SOAP fault with error code 0x82000006.] This indicates that the list does not exist or might have been deleted by another user.");
            }

            if (Common.IsRequirementEnabled(2499, this.Site))
            {
                this.Site.Log.Add(
                       LogEntryKind.Debug,
                       "The actual value:errorCode[{0}] errorString[{1}] for requirement #R2499",
                       string.IsNullOrEmpty(errorCode) ? "NullOrEmpty" : errorCode,
                        string.IsNullOrEmpty(errorString) ? "NullOrEmpty" : errorString);

                string expectedErrorString = "Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).";
                Site.CaptureRequirementIfIsTrue(
                      string.IsNullOrEmpty(errorCode) && expectedErrorString.Equals(errorString, StringComparison.OrdinalIgnoreCase),
                      2499,
                      @"[In Appendix B: Product Behavior] Implementation does not return a SOAP fault with error code 0x82000006. (<75> Section 3.1.4.28: Windows SharePoint Services 3.0 return the following SOAP fault with no error code: ""GUID should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx)"".)");
            }
            #endregion
        }
コード例 #4
0
        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
        }
コード例 #5
0
        public void MSLISTSWS_S02_TC67_UpdateContentTypesXmlDocument_IncorrectContentTypeId()
        {
            #region Add a list
            string listName = TestSuiteHelper.GetUniqueListName();
            string listId = TestSuiteHelper.CreateList(listName);
            #endregion Add a list

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

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

            #region  UpdateContentTypesXmlDocument
            // Construct the newDocument parameter for the invocation below.
            UpdateContentTypesXmlDocumentNewDocument docForInvalidContentTypeId = new UpdateContentTypesXmlDocumentNewDocument();

            docForInvalidContentTypeId.ContentTypes = new UpdateContentTypesXmlDocumentNewDocumentContentType[1];

            string namespaceUri1 = Common.GetConfigurationPropertyValue("ContentTypeXmlNamespaceUri", this.Site);
            string innerXml = Common.GetConfigurationPropertyValue("ValidContentTypeXmlDocument", this.Site);
            string qualifiedName = Common.GetConfigurationPropertyValue("ListFieldText", this.Site);

            docForInvalidContentTypeId.ContentTypes[0] = new UpdateContentTypesXmlDocumentNewDocumentContentType();
            XmlDocument doc = new XmlDocument();
            docForInvalidContentTypeId.ContentTypes[0].Any = doc.CreateElement(qualifiedName, namespaceUri1);
            docForInvalidContentTypeId.ContentTypes[0].Any.InnerXml = innerXml;

            // Set an invalid ContentTypeId.
            string invalidContentTypeId = TestSuiteHelper.GetInvalidGuidAndNocorrespondString();
            docForInvalidContentTypeId.ContentTypes[0].ID = invalidContentTypeId;

            try
            {
                this.listswsAdapter.UpdateContentTypesXmlDocument(listId, docForInvalidContentTypeId);
                Site.Assert.Fail("Calling UpdateContentType should fail");
            }
            catch (SoapException ex)
            {
                string errorCode = TestSuiteHelper.GetErrorCode(ex);

                Site.CaptureRequirementIfIsNotNull(
                    ex,
                    841,
                    @"[In UpdateContentTypesXmlDocument operation] If the content type specified by the ContentType.ID attribute is not found, the protocol server MUST return a SOAP fault.");

                Site.CaptureRequirementIfIsNull(
                    errorCode,
                    2009,
                    @"[In UpdateContentTypesXmlDocument operation] [If the content type specified by the ContentType.ID attribute is not found, the protocol server MUST return a SOAP fault.] There is no error code for this fault.");
            }

            // Construct another newDocument parameter to verify R842 and R2010.
            UpdateContentTypesXmlDocumentNewDocument docForEmptyChildElements = new UpdateContentTypesXmlDocumentNewDocument();
            docForEmptyChildElements.ContentTypes = new UpdateContentTypesXmlDocumentNewDocumentContentType[1];
            docForEmptyChildElements.ContentTypes[0] = new UpdateContentTypesXmlDocumentNewDocumentContentType();
            docForEmptyChildElements.ContentTypes[0].ID = contextTypeId;

            try
            {
                this.listswsAdapter.UpdateContentTypesXmlDocument(listId, docForEmptyChildElements);
                Site.Assert.Fail("Calling UpdateContentType should fail");
            }
            catch (SoapException ex)
            {
                string errorCode = TestSuiteHelper.GetErrorCode(ex);

                Site.CaptureRequirementIfIsNotNull(
                    ex,
                    842,
                    @"[In UpdateContentTypesXmlDocument operation] If the content type specified by the ContentType.ID attribute does not contain any child elements, the protocol server MUST return a SOAP fault.");

                Site.CaptureRequirementIfIsNull(
                    errorCode,
                    2010,
                    @"[In UpdateContentTypesXmlDocument operation] [If the content type specified by the ContentType.ID attribute does not contain any child elements, the protocol server MUST return a SOAP fault.] There is no error code for this fault.");
            }

            #endregion
        }
コード例 #6
0
 /// <remarks/>
 public void UpdateContentTypesXmlDocumentAsync(string listName, UpdateContentTypesXmlDocumentNewDocument newDocument, object userState)
 {
     if ((this.UpdateContentTypesXmlDocumentOperationCompleted == null))
     {
         this.UpdateContentTypesXmlDocumentOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateContentTypesXmlDocumentOperationCompleted);
     }
     this.InvokeAsync("UpdateContentTypesXmlDocument", new object[] {
             listName,
             newDocument}, this.UpdateContentTypesXmlDocumentOperationCompleted, userState);
 }
コード例 #7
0
 /// <remarks/>
 public void UpdateContentTypesXmlDocumentAsync(string listName, UpdateContentTypesXmlDocumentNewDocument newDocument)
 {
     this.UpdateContentTypesXmlDocumentAsync(listName, newDocument, null);
 }
コード例 #8
0
 /// <remarks/>
 public System.IAsyncResult BeginUpdateContentTypesXmlDocument(string listName, UpdateContentTypesXmlDocumentNewDocument newDocument, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("UpdateContentTypesXmlDocument", new object[] {
             listName,
             newDocument}, callback, asyncState);
 }
コード例 #9
0
 public UpdateContentTypesXmlDocumentResponseUpdateContentTypesXmlDocumentResult UpdateContentTypesXmlDocument(string listName, UpdateContentTypesXmlDocumentNewDocument newDocument)
 {
     object[] results = this.Invoke("UpdateContentTypesXmlDocument", new object[] {
             listName,
             newDocument});
     return ((UpdateContentTypesXmlDocumentResponseUpdateContentTypesXmlDocumentResult)(results[0]));
 }