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

MSLISTSWS_S02_TC47_GetListContentTypes_Succeed_WithGuid() private method

        public void MSLISTSWS_S02_TC47_GetListContentTypes_Succeed_WithGuid()
        {
            #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 contentTypeId = TestSuiteHelper.CreateContentType(listId, displayName, fields);

            this.Site.Assert.IsTrue(!string.IsNullOrEmpty(contentTypeId), "CreateContentType successfully.");
            #endregion CreateContentType

            #region GetListContentTypes
            GetListContentTypesResponseGetListContentTypesResult listContentTypes = this.listswsAdapter.GetListContentTypes(listId, string.Empty);
            this.Site.Assert.IsNotNull(listContentTypes, "Calling GetListContentTypes successfully.");

            // Verify requirement R6101.
            // If getting content type is successful, it means implementation does support this GetListContentTypes method. R6101 can be captured.
            if (Common.IsRequirementEnabled(6101, this.Site))
            {
                Site.CaptureRequirementIfIsNotNull(
                    listContentTypes,
                    6101,
                    @"Implementation does support this method[GetListContentTypes]. (Windows SharePoint Services 3.0 and above follow this behavior.)");
            }

            bool isR608Verified = listContentTypes.ContentTypes.ContentType.Any(contentType => contentType.ID.Equals(contentTypeId, StringComparison.OrdinalIgnoreCase));

            // If the create content type can be found in GetListContentTypes response, that means the list is the expected list, Then capture R608.
            Site.CaptureRequirementIfIsTrue(
                isR608Verified,
                608,
                @"[In GetListContentTypes operation] If the specified listName is a valid GUID and corresponds to the identification of a list on the site, the protocol server MUST use that list.");

            #endregion
        }
S02_OperationOnContentType