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

MSLISTSWS_S03_TC79_UpdateListItemsWithKnowledge_LockSchema() private method

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

            // Create a list.
            string listId = TestSuiteHelper.CreateList();

            // Get the Field name which has been add into current list.
            string validFieldName = Common.GetConfigurationPropertyValue("ListFieldText", this.Site);

            // Call GetList to get the current list version.
            ListDefinitionSchema listDef = TestSuiteHelper.GetListDefinition(listId);

            // Construct three items: the second one is invalid, the first and the last one are valid.
            List<Dictionary<string, string>> items = new List<Dictionary<string, string>>(3);
            List<MethodCmdEnum> cmds = new List<MethodCmdEnum>();

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

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

            // Make sure the LockSchema is not specified.
            // This will make the server treat it as default false value.
            updates.Batch.LockSchema = null;

            // Set an incorrect list version value.
            updates.Batch.ListVersion = (uint)listDef.Version + 1;
            updates.Batch.ListVersionSpecified = true;

            UpdateListItemsWithKnowledgeResponseUpdateListItemsWithKnowledgeResult result =
            result = this.listswsAdapter.UpdateListItemsWithKnowledge(
                                                    listId,
                                                    updates,
                                                    null,
                                                    null);

            // There must be one result element.
            Site.Assert.AreEqual<int>(
                                    1,
                                    result.Results.Length,
                                    "There are at least one result corresponding with the one New method");

            // If there is no SoapException and the error code equals 0x00000000,
            // capture requirement R2085.
            Site.CaptureRequirementIfAreEqual<string>(
                "0x00000000",
                result.Results[0].ErrorCode,
                2349,
                "[In UpdateListItemsWithKnowledge][In Bench element][In LockSchema attribute] "
                        + "This defaults to FALSE.[ the server will not fail, if the schema version passed in "
                        + "by the protocol client does not match the list schema version on the protocol server. ]");
        }
S03_OperationOnListItem