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

MSLISTSWS_S02_TC34_GetListContentTypesAndProperties_IncorrectListName() private method

        public void MSLISTSWS_S02_TC34_GetListContentTypesAndProperties_IncorrectListName()
        {
            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 operation should succeed.");
            #endregion CreateContentType

            #region GetListContentTypesAndProperties
            string invalidList = DateTime.Now.TimeOfDay.ToString();
            string propertyPrefix = AdapterHelper.PrefixOws;

            try
            {
                this.listswsAdapter.GetListContentTypesAndProperties(invalidList, contextType, propertyPrefix, true, true);
                Site.Assert.Fail("GetListContentTypeAndProperties should fail, but it passed.");
            }
            catch (SoapException exp)
            {
                Site.CaptureRequirementIfAreEqual<string>(
                    "0x82000006",
                    exp.Detail.LastChild.InnerText,
                    1042,
                    @"[In GetListContentTypesAndProperties]If listName does not correspond to a list from either of these checks, the protocol server MUST return a SOAP fault with error code 0x82000006.");
            }

            try
            {
                this.listswsAdapter.GetList(invalidList);

                Site.Assert.Fail("Get list should fail with invalidList but it passed.");
            }
            catch (SoapException exp)
            {
                Site.CaptureRequirementIfAreEqual<string>(
                    "0x82000006",
                    exp.Detail.LastChild.InnerText,
                    1043,
                    @"[In [In GetListContentTypesAndProperties][If listName does not correspond to a list from either of these checks, the protocol server MUST return a SOAP fault with error code 0x82000006.] This indicates that the list does not exist or might have been deleted by another user.");
            }

            #endregion
        }
S02_OperationOnContentType