public void MSLISTSWS_S03_TC88_UpdateListItems_InvalidListTitle()
{
// Get the configure value.
string validFieldName = Common.GetConfigurationPropertyValue("ListFieldText", this.Site);
string fieldValue = TestSuiteHelper.GenerateRandomString(5);
// Construct one new item.
List<Dictionary<string, string>> items = new List<Dictionary<string, string>>();
List<MethodCmdEnum> cmds = new List<MethodCmdEnum>();
Dictionary<string, string> item1 = new Dictionary<string, string>();
item1.Add(validFieldName, fieldValue);
items.Add(item1);
cmds.Add(MethodCmdEnum.New);
UpdateListItemsUpdates updates = TestSuiteHelper.CreateUpdateListItems(cmds, items, OnErrorEnum.Continue);
UpdateListItemsResponseUpdateListItemsResult result = null;
bool isSoapFault = false;
string errorCode = null;
try
{
result = this.listswsAdapter.UpdateListItems(
TestSuiteHelper.GetUniqueListName(),
updates);
}
catch (SoapException exp)
{
errorCode = TestSuiteHelper.GetErrorCode(exp);
isSoapFault = true;
}
Site.Assert.IsTrue(
isSoapFault,
"When call the operation UpdateListItems, the list name is not exist GUID. The server will return a soap fault.");
// If error code equals 0x82000006, capture R2770.
if (Common.IsRequirementEnabled(2770, this.Site))
{
Site.CaptureRequirementIfAreEqual<string>(
"0x82000006",
errorCode,
2770,
@"[In UpdateListItems operation] Implementation does return a SOAP fault with error code 0x82000006, if listName does not correspond to a list from either of these checks. (SharePoint Foundation 2010 follow this behavior.)");
}
// If SUT is SharePointFoundation2013 or SharePointServer2013, the error code equals 0x82000006.
string sutVersion = Common.GetConfigurationPropertyValue("SutVersion", this.Site);
if (sutVersion == "SharePointFoundation2013" || sutVersion == "SharePointServer2013")
{
Site.Assert.AreEqual<string>(
"0x82000006",
errorCode,
@"{0} return a SOAP fault with error code 0x82000006, when the specified listName is a valid GUID and does not correspond to the identification of a list on the site.",
sutVersion);
}
try
{
result = this.listswsAdapter.UpdateListItems(
Guid.NewGuid().ToString(),
updates);
}
catch (SoapException exp)
{
errorCode = TestSuiteHelper.GetErrorCode(exp);
isSoapFault = true;
}
if (Common.IsRequirementEnabled(27701, this.Site))
{
Site.CaptureRequirementIfAreEqual<string>(
"0x82000006",
errorCode,
27701,
@"[In Appendix B: Product Behavior] [In UpdateListItems operation] Implementation does return a SOAP fault with error code 0x81020026, when the specified listName is a valid GUID and does not correspond to the identification of a list on the site. (SharePoint Foundation 2013 follow this behavior.)");
}
// Create a list.
string listId = TestSuiteHelper.CreateList();
// Construct one update item.
items = new List<Dictionary<string, string>>();
cmds = new List<MethodCmdEnum>();
item1 = new Dictionary<string, string>();
item1.Add(validFieldName, fieldValue);
// This list is empty, so just generate an ID randomly. Then the items should not exist.
item1.Add(AdapterHelper.FieldIDName, TestSuiteHelper.GenerateRandomNumber(1, 9));
items.Add(item1);
cmds.Add(MethodCmdEnum.Update);
updates = TestSuiteHelper.CreateUpdateListItems(cmds, items, OnErrorEnum.Continue);
// Call UpdateListItems to use an non-exist list item id.
result = this.listswsAdapter.UpdateListItems(
listId,
updates);
this.Site.Assert.AreEqual<int>(
1,
result.Results.Length,
"After call UpdateListItems with one item updating in request, there must be one result element in the response");
this.Site.CaptureRequirementIfAreEqual<string>(
"0x81020016",
result.Results[0].ErrorCode,
975,
"[In UpdateListItems operation] [In UpdateListItemsResponse element]"
+ "[In UpdateListItemsResult element] This [error code 0x81020016] specifies"
+ "that the list item referred to in the request does not exist.");
this.Site.CaptureRequirementIfAreEqual<string>(
"0x81020016",
result.Results[0].ErrorCode,
932,
"[In UpdateListItems operation] [In UpdateListItems element] [In updates element] [In Batch element] [In Method element] [Update attribute] [If additional field references not set those columns to the value specified] an error will be returned.");
this.Site.Log.Add(
LogEntryKind.Debug,
"The actual value: ErrorCode[{0}] for requirement #R2117",
result.Results[0].ErrorCode);
this.Site.CaptureRequirementIfIsTrue(
result.Results[0].ErrorCode.IndexOf("0x", StringComparison.OrdinalIgnoreCase) == 0,
2117,
@"[UpdateListItemsResponse]Otherwise, [If an operation does not complete successfully] the ErrorCode MUST be set to a hexadecimal representation of the error encountered.");
}