public void MSLISTSWS_S02_TC24_DeleteContentType_NonExistentContentType()
{
#region Add a list
// Add a new list to the server.
string listId = TestSuiteHelper.CreateList();
bool isListCreatedSuccessfully = !string.IsNullOrEmpty(listId);
this.Site.Assert.IsTrue(isListCreatedSuccessfully, "Test suite should create the list successfully.");
#endregion Add a list
#region CreateContentType
// Create a contentType
string displayName = TestSuiteHelper.GetUniqueContentTypeName();
List<string> fieldNames = new List<string>();
string fieldsName = Common.GetConfigurationPropertyValue("ListFieldText", this.Site);
fieldNames.Add(fieldsName);
bool createContentTypeSucceeded = false;
string contentType = TestSuiteHelper.CreateContentType(listId, displayName, fieldNames);
createContentTypeSucceeded = !string.IsNullOrEmpty(contentType);
this.Site.Assert.IsTrue(createContentTypeSucceeded, "CreateContentType Should succeed.");
#endregion CreateContentType
#region DeleteContentType
// Create an invalid contentTypeID
string contentTypeID = TestSuiteHelper.GetInvalidGuidAndNocorrespondString();
string errorCode = string.Empty;
bool isExistentFault = false;
try
{
this.listswsAdapter.DeleteContentType(listId, contentTypeID);
}
catch (SoapException exp)
{
errorCode = TestSuiteHelper.GetErrorCode(exp);
isExistentFault = true;
}
this.Site.Assert.IsTrue(isExistentFault, "The server response should contain a SOAP fault while requesting DeleteContentType operation when the contentType cannot be found.");
// If a SOAP fault is returned, then capture R496.
Site.CaptureRequirementIfIsTrue(
isExistentFault,
496,
@"[In DeleteContentType operation] If the operation fails, a SOAP fault MUST be returned.");
// If the error code returned is null, then capture R1714.
Site.CaptureRequirementIfIsNull(
errorCode,
1714,
@"[In DeleteContentType operation] [If the content type cannot be found on the list, the protocol server MUST return a SOAP fault.]There is no error code for this fault.");
#endregion DeleteContentType
}