public void MSOXWSATT_S01_TC09_AttachmentToAttachment()
{
#region Step 1 Create an item attachment, which contains an ItemType item as the child item, on an item.
// Create an item attachment by CreateAttachment operation.
CreateAttachmentResponseType createAttachmentResponse = this.CallCreateAttachmentOperation(this.ItemId.Id, AttachmentTypeValue.ItemAttachment);
AttachmentInfoResponseMessageType createAttachmentInfoResponse = createAttachmentResponse.ResponseMessages.Items[0] as AttachmentInfoResponseMessageType;
// Check the response.
Common.CheckOperationSuccess(createAttachmentResponse, 1, this.Site);
this.VerifyCreateAttachmentSuccessfulResponse(createAttachmentResponse);
// Gets the ID of the created attachment.
AttachmentType createdAttachment = createAttachmentInfoResponse.Attachments[0];
AttachmentIdType createdAttachmentId = createdAttachment.AttachmentId;
#endregion
#region Step 2 Create an attachment to the attachment created in step 1.
// Create an item attachment by CreateAttachment operation.
CreateAttachmentResponseType createAttachmentAttachmentResponse = this.CallCreateAttachmentOperation(createdAttachmentId.Id, AttachmentTypeValue.ItemAttachment);
AttachmentInfoResponseMessageType createAttachmentAttachmentInfoResponse = createAttachmentAttachmentResponse.ResponseMessages.Items[0] as AttachmentInfoResponseMessageType;
// Check the response.
Common.CheckOperationSuccess(createAttachmentAttachmentResponse, 1, this.Site);
#endregion
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSATT_R14201");
// When the parent attachment and its attachment both created successfully, this requirement can be captured.
bool isR14201Verified = createAttachmentInfoResponse.ResponseClass == ResponseClassType.Success && createAttachmentAttachmentInfoResponse.ResponseClass == ResponseClassType.Success;
// Verify MS-OXWSATT requirement: MS-OXWSATT_R14201
Site.CaptureRequirementIfIsTrue(
isR14201Verified,
14201,
@"[In CreateAttachment Operation] It [item attachment] exists as an attachment to an item or another attachment.");
// Gets the ID of the created attachment.
AttachmentType createdAttachmentAttachment = createAttachmentAttachmentInfoResponse.Attachments[0];
AttachmentIdType createdAttachmentAttachmentId = createdAttachmentAttachment.AttachmentId;
#region Step 3 Get the parent attachment created in step 1 by the GetAttachment operation.
GetAttachmentResponseType getAttachmentResponse = this.CallGetAttachmentOperation(BodyTypeResponseType.Best, false, createdAttachmentId);
// Check the response.
Common.CheckOperationSuccess(getAttachmentResponse, 1, this.Site);
this.VerifyGetAttachmentSuccessfulResponse(getAttachmentResponse);
#endregion
#region Step 4 Get the attachment's attachment created in step 2 by the GetAttachment operation.
GetAttachmentResponseType getAttachmentAttachmentResponse = this.CallGetAttachmentOperation(BodyTypeResponseType.Best, false, createdAttachmentAttachmentId);
// Check the response.
Common.CheckOperationSuccess(getAttachmentAttachmentResponse, 1, this.Site);
this.VerifyGetAttachmentSuccessfulResponse(getAttachmentAttachmentResponse);
#endregion
#region Step 5 Delete the attachment's attachment created in step 2 by the DeleteAttachment operation.
DeleteAttachmentResponseType deleteAttachmentAttachmentResponse = this.CallDeleteAttachmentOperation(createdAttachmentAttachmentId);
DeleteAttachmentResponseMessageType deleteAttachmentAttachmentResponseMessage = deleteAttachmentAttachmentResponse.ResponseMessages.Items[0] as DeleteAttachmentResponseMessageType;
// Check the response.
Common.CheckOperationSuccess(deleteAttachmentAttachmentResponse, 1, this.Site);
this.VerifyDeleteAttachmentSuccessfulResponse(deleteAttachmentAttachmentResponse);
#endregion
#region Step 6 Delete the parent attachment created in step 1 by the DeleteAttachment operation.
DeleteAttachmentResponseType deleteAttachmentResponse = this.CallDeleteAttachmentOperation(createdAttachmentId);
DeleteAttachmentResponseMessageType deleteAttachmentResponseMessage = deleteAttachmentResponse.ResponseMessages.Items[0] as DeleteAttachmentResponseMessageType;
// Check the response.
Common.CheckOperationSuccess(deleteAttachmentResponse, 1, this.Site);
#endregion
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSATT_R20001");
// When the parent attachment and its attachment both deleted successfully, this requirement can be captured.
bool isR20001Verified = deleteAttachmentResponseMessage.ResponseClass == ResponseClassType.Success && deleteAttachmentAttachmentResponseMessage.ResponseClass == ResponseClassType.Success;
// Verify MS-OXWSATT requirement: MS-OXWSATT_R20001
Site.CaptureRequirementIfIsTrue(
isR20001Verified,
20001,
@"[In DeleteAttachment Operation] It [the item attachment] exists as an attachment on an item or another attachment.");
this.VerifyDeleteAttachmentSuccessfulResponse(deleteAttachmentResponse);
}