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

MSLISTSWS_S02_TC44_GetListContentTypes_NoBestMatch() private method

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

            bool isListCreatedSuccessful = !string.IsNullOrEmpty(listName);
            this.Site.Assert.IsTrue(isListCreatedSuccessful, "Create list succeeded.");
            #endregion Add a list

            #region GetListContentTypes using the list's GUID,specifing a "best match" field with an invalid content type id that the server cannot find.
            string contentTypeId = TestSuiteHelper.GetInvalidGuidAndNocorrespondString();
            GetListContentTypesResponseGetListContentTypesResult listContentTypes = this.listswsAdapter.GetListContentTypes(listName, contentTypeId);

            Site.Assert.IsNotNull(listContentTypes, @"[In GetListContentTypes operation] If the specified listName a valid GUID, the protocol server MUST return a GetListResponse element.");
            int bestMatchCount = 0;
            foreach (GetListContentTypesResponseGetListContentTypesResultContentTypesContentType ct in listContentTypes.ContentTypes.ContentType)
            {
                if (ct.BestMatchSpecified == true)
                {
                    bestMatchCount++;
                }
            }

            // Verify MS-LISTSWS requirement: MS-LISTSWS_R1828
            Site.CaptureRequirementIfAreEqual<int>(0, bestMatchCount, 1828, @"[GetListContentTypes]If the server is unable to find a ""best match,"" the server MUST NOT set the BestMatch attribute to ""TRUE"" for any of the content types returned in the GetListContentTypesResponse element.");
            #endregion
        }
S02_OperationOnContentType