Microsoft.Protocols.TestSuites.MS_OXWSATT.S01_AttachmentProcessing.MSOXWSATT_S01_TC11_ProcessReferenceAttachment C# (CSharp) Method

MSOXWSATT_S01_TC11_ProcessReferenceAttachment() private method

private MSOXWSATT_S01_TC11_ProcessReferenceAttachment ( ) : void
return void
        public void MSOXWSATT_S01_TC11_ProcessReferenceAttachment()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(318011, this.Site), "Exchange 2007 and Exchange 2010 do not introduce the ReferenceAttachmentType complex type.");

            #region Step 1 Create a reference attachment.

            // Create a file attachment by CreateAttachment operation.
            CreateAttachmentResponseType createAttachmentResponse = this.CallCreateAttachmentOperation(this.ItemId.Id, AttachmentTypeValue.ReferenceAttachment);
            AttachmentInfoResponseMessageType createAttachmentInfoResponse = createAttachmentResponse.ResponseMessages.Items[0] as AttachmentInfoResponseMessageType;

            // Check the response.
            Common.CheckOperationSuccess(createAttachmentResponse, 1, this.Site);

            // Gets the ID of the created attachment.
            AttachmentType createdAttachment = createAttachmentInfoResponse.Attachments[0];
            AttachmentIdType createdAttachmentId = createdAttachment.AttachmentId;
            #endregion

            #region Step 2 Get the reference attachment created in step 1 by the GetAttachment operation.

            GetAttachmentResponseType getAttachmentResponse = this.CallGetAttachmentOperation(BodyTypeResponseType.Text, false, createdAttachmentId);

            // Check the response.
            Common.CheckOperationSuccess(getAttachmentResponse, 1, this.Site);
            AttachmentInfoResponseMessageType getAttachmentInfoResponse = getAttachmentResponse.ResponseMessages.Items[0] as AttachmentInfoResponseMessageType;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSATT_R38002");

            this.Site.CaptureRequirementIfIsTrue(
                getAttachmentInfoResponse.Attachments.Length == 1,
                38002,
                @"[In t:ArrayOfAttachmentsType Complex Type] [The ReferenceAttachment element ] Specifies an reference that is attached to another item");

            ReferenceAttachmentType attachmentInRequest = this.Attachments[0] as ReferenceAttachmentType;
            ReferenceAttachmentType attachmentInResponse = getAttachmentInfoResponse.Attachments[0] as ReferenceAttachmentType;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSATT_R104006");

            this.Site.CaptureRequirementIfAreEqual<string>(
                attachmentInRequest.AttachLongPathName,
                attachmentInResponse.AttachLongPathName,
                104006,
                @"[t:ReferenceAttachmentType Complex Type] [The AttachLongPathName element] Specifies the URL of the attachment.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSATT_R104008");

            this.Site.CaptureRequirementIfAreEqual<string>(
                attachmentInRequest.ProviderType,
                attachmentInResponse.ProviderType,
                104008,
                @"[t:ReferenceAttachmentType Complex Type] [The ProviderType element] Specifies the provider type.");

             // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSATT_R104012");

            this.Site.CaptureRequirementIfAreEqual<string>(
                attachmentInRequest.AttachmentThumbnailUrl,
                attachmentInResponse.AttachmentThumbnailUrl,
                104012,
                @"[t:ReferenceAttachmentType Complex Type] [The AttachmentThumbnailUrl element] Specifies the Url of the thumbnail of the attachment.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSATT_R104014");

            this.Site.CaptureRequirementIfAreEqual<string>(
                attachmentInRequest.AttachmentPreviewUrl,
                attachmentInResponse.AttachmentPreviewUrl,
                104014,
                @"[t:ReferenceAttachmentType Complex Type] [The AttachmentPreviewUrl element] Specifies the Url of the attachment preview.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSATT_R104016");

            this.Site.CaptureRequirementIfAreEqual<int>(
                attachmentInRequest.PermissionType,
                attachmentInResponse.PermissionType,
                104016,
                @"[t:ReferenceAttachmentType Complex Type] [The PermissionType element] Specifies the permission type.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSATT_R104018");

            this.Site.CaptureRequirementIfAreEqual<bool>(
                attachmentInResponse.AttachmentIsFolder,
                attachmentInResponse.AttachmentIsFolder,
                104018,
                @"[t:ReferenceAttachmentType Complex Type] [The AttachmentIsFolder element] Specifies that the attachment is a folder.");
            #endregion

            #region Step 3 Delete the reference 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
        }