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

MSLISTSWS_S02_TC27_GetListContentType_IncorrectContentType() private method

        public void MSLISTSWS_S02_TC27_GetListContentType_IncorrectContentType()
        {
            #region Add a list

            string listId = TestSuiteHelper.CreateList();

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

            #endregion Add a list

            #region CreateContentType
            List<string> filedNames = new List<string>() { Common.GetConfigurationPropertyValue("ListFieldText", this.Site) };
            string parentTypeName = TestSuiteHelper.GetFirstExistContentTypeName(listId);

            this.Site.Assert.IsTrue(!string.IsNullOrEmpty(parentTypeName), "Get exist Content Type succeeded.");

            string createdContentTypeID = TestSuiteHelper.CreateContentType(
                                                                        listId,
                                                                        "CreateContentTypeDescriptionOf" + TestSuiteHelper.GenerateRandomString(5),
                                                                        filedNames);

            bool isCreateContentTypeSuccessful = !string.IsNullOrEmpty(createdContentTypeID);
            this.Site.Assert.IsTrue(isCreateContentTypeSuccessful, "CreateContentType succeeded.");

            #endregion CreateContentType

            #region GetListContentType
            // Use incorrect contentTypeID, it should be invalid guid type format.
            string invalidContentTypeID = Guid.NewGuid().ToString("N");
            bool isExistSoapFault = false;
            string errorCode = string.Empty;
            try
            {
                this.listswsAdapter.GetListContentType(listId, invalidContentTypeID);
            }
            catch (SoapException soapEx)
            {
                isExistSoapFault = true;
                errorCode = TestSuiteHelper.GetErrorCode(soapEx);
            }

            Site.Assert.IsTrue(isExistSoapFault, "The server response should contain a SOAP fault while requesting GetListContentType when the specified ContentType id is not exist.");

            Site.CaptureRequirementIfIsTrue(
                isExistSoapFault,
                595,
                @"[In GetListContentType operation] If contentTypeId does not match a content type identifier on the list, the protocol server MUST return a SOAP fault.");

            Site.CaptureRequirementIfIsTrue(
                string.IsNullOrEmpty(errorCode),
                1805,
                @"[In GetListContentType operation] [If contentTypeId does not match a content type identifier on the list, the protocol server MUST return a SOAP fault.]There is no error code for this fault.");

            #endregion
        }
S02_OperationOnContentType