public void MSLISTSWS_S02_TC61_UpdateContentType_IncorrectListName()
{
Site.Assume.IsTrue(Common.IsRequirementEnabled(2766, this.Site), @"Test is executed only when R2766Enabled 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, "Creating list successfully.");
#endregion Add a list
#region Invoke GetListContentTypes to get the old version
GetListContentTypesResponseGetListContentTypesResult result = this.listswsAdapter.GetListContentTypes(listName, null);
this.Site.Assert.IsNotNull(result, "GetListContentTypes should succeed.");
#endregion
#region Abstract Value Bind
UpdateContentTypeContentTypeProperties properties = new UpdateContentTypeContentTypeProperties();
properties.ContentType = new ContentTypePropertyDefinition();
AddOrUpdateFieldsDefinition addFields = TestSuiteHelper.CreateAddContentTypeFields(Common.GetConfigurationPropertyValue("ListFieldText", this.Site));
#endregion
#region UpdateContentType
string invalidList = DateTime.Now.TimeOfDay.ToString();
bool caughtSoapException = false;
try
{
this.listswsAdapter.UpdateContentType(invalidList, result.ContentTypes.ContentType[0].ID, properties, addFields, null, null, bool.TrueString);
Site.Assert.Fail("UpdateContentType should fail when the list name is neither the exist GUID nor title, but it passed.");
}
catch (SoapException exp)
{
caughtSoapException = true;
Site.CaptureRequirementIfAreEqual<string>(
"0x82000006",
exp.Detail.LastChild.InnerText,
2766,
@"[In UpdateContentType 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 and above follow this behavior.)");
Site.CaptureRequirementIfAreEqual<string>(
"0x82000006",
exp.Detail.LastChild.InnerText,
1975,
@"[In UpdateContentType operation] [If the specified listName does not correspond to a list from either of these checks, a SOAP fault should<73> be returned with error code 0x82000006.] This indicates that the list does not exist or might have been deleted by another user.");
}
finally
{
Site.Assert.IsTrue(caughtSoapException, "A SOAP exception should be thrown by the server when invoke the operation 'UpdateContentType' with incorrect listName.");
}
#endregion UpdateContentType
}