Microsoft.Protocols.TestSuites.MS_LISTSWS.S03_OperationOnListItem.MSLISTSWS_S03_TC77_UpdateListItemsWithKnowledge_Fail_ListNameIsEmpty C# (CSharp) Method

MSLISTSWS_S03_TC77_UpdateListItemsWithKnowledge_Fail_ListNameIsEmpty() private method

        public void MSLISTSWS_S03_TC77_UpdateListItemsWithKnowledge_Fail_ListNameIsEmpty()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(25151, this.Site), @"Test is executed only when R25151Enabled is set to true.");

            // Read configure value.
            string validFieldName = Common.GetConfigurationPropertyValue("ListFieldText", this.Site);
            string errorCode = string.Empty;

            // Identify whether the SoapException is returned.
            bool isSoapRaultReturned = false;

            // Construct one insert item
            List<Dictionary<string, string>> items = new List<Dictionary<string, string>>(1);
            List<MethodCmdEnum> cmds = new List<MethodCmdEnum>(1);
            Dictionary<string, string> item1 = new Dictionary<string, string>();
            item1.Add(validFieldName, TestSuiteHelper.GenerateRandomString(5));
            items.Add(item1);
            cmds.Add(MethodCmdEnum.New);

            // Construct the UpdateListItemsUpdates instances
            UpdateListItemsWithKnowledgeUpdates updates = TestSuiteHelper.CreateUpdateListWithKnowledgeItems(cmds, items, OnErrorEnum.Continue);

            Site.Assert.IsNotNull(updates, "Created UpdateListItemsWithKnowledgeUpdates successfully");

            try
            {
                // Call UpdateListItemsWithKnowledge with an empty ListName.
                this.listswsAdapter.UpdateListItemsWithKnowledge(
                                                                string.Empty,
                                                                updates,
                                                                null,
                                                                null);
            }
            catch (SoapException soapException)
            {
                isSoapRaultReturned = true;
                errorCode = TestSuiteHelper.GetErrorCode(soapException);

                #region Capture Requirements R3042

                // If there throws soap exception, and with no error code, then R3024 should be covered.
                Site.Log.Add(
                LogEntryKind.Debug,
                "The actual value: errorCode[{0}] for requirement #R3024",
                    string.IsNullOrEmpty(errorCode) ? "NullOrEmpty" : errorCode);

                Site.CaptureRequirementIfIsTrue(
                    string.IsNullOrEmpty(errorCode),
                    3024,
                    @"[In UpdateListItemsWithKnowledge] If the specified listName is empty,
                the protocol server MUST return a SOAP fault with no error code.");

                #endregion
            }

            Site.Assert.IsTrue(isSoapRaultReturned, "UpdateListItemsWithKnowledgeUpdates operation throws SoapException when the specified listName is empty string.");
        }
S03_OperationOnListItem