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

MSLISTSWS_S02_TC37_GetListContentTypesAndProperties_Succeed_WithGuid() private method

        public void MSLISTSWS_S02_TC37_GetListContentTypesAndProperties_Succeed_WithGuid()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(2230, this.Site), @"Test is executed only when R2230Enabled 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, "Create List succeeded.");

            #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), "CreateContentType succeeded.");
            #endregion CreateContentType

            #region GetListContentTypesAndProperties
            string propertyPrefix = AdapterHelper.PrefixOws;
            GetListContentTypesAndPropertiesResponseGetListContentTypesAndPropertiesResult getListContentTypesAndPropertiesResult = null;

            getListContentTypesAndPropertiesResult = this.listswsAdapter.GetListContentTypesAndProperties(listId, contextType, propertyPrefix, true, true);
            if (getListContentTypesAndPropertiesResult == null)
            {
                Site.Assert.Fail("The response of the GetListContentTypesAndProperties should be not null, but actually it is null.");
            }

            bool isR1040Verified = (from contentType in getListContentTypesAndPropertiesResult.ContentTypes.ContentType
                                    where contentType.ID == contextType
                                    select contentType).ToArray().Length == 1;

            Site.CaptureRequirementIfIsTrue(
                isR1040Verified,
                1040,
                @"[In GetListContentTypesAndProperties]If 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