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

MSOXWSATT_S01_TC06_ProcessPostItemTypeItemAttachment() private method

        public void MSOXWSATT_S01_TC06_ProcessPostItemTypeItemAttachment()
        {
            #region Step 1 Create an item attachment, which contains a PostItemType item as the child item, on an item.

            // Create an item attachment by CreateAttachment operation.
            CreateAttachmentResponseType createAttachmentResponse = this.CallCreateAttachmentOperation(this.ItemId.Id, AttachmentTypeValue.PostAttachment);
            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.
            AttachmentIdType createdAttachmentId = createAttachmentInfoResponse.Attachments[0].AttachmentId;

            #endregion

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

            GetAttachmentResponseType getAttachmentResponse = this.CallGetAttachmentOperation(BodyTypeResponseType.Best, true, createdAttachmentId);
            AttachmentInfoResponseMessageType getAttachmentInfoResponse = getAttachmentResponse.ResponseMessages.Items[0] as AttachmentInfoResponseMessageType;

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

            #endregion

            if (Common.IsRequirementEnabled(55002, this.Site))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSATT_R55002");

                // Verify MS-OXWSATT requirement: MS-OXWSATT_R55002
                // If the MIMEContent of returned attachment is not null, this requirement can be captured.
                Site.CaptureRequirementIfIsNotNull(
                    ((ItemAttachmentType)getAttachmentInfoResponse.Attachments[0]).Item.MimeContent,
                    55002,
                    @"[In Appendix C: Product Behavior] Implementation does return MIME content. (<10> Section 3.1.4.3.3.3:  In Exchange 2007, Exchange 2010, Microsoft Exchange Server 2010 Service Pack 1 (SP1) and Microsoft Exchange Server 2010 Service Pack 2 (SP2), if the IncludeMimeContent element is set to true in the AttachmentResponseShapeType complex type, the MIME content will be returned for attachment of the item class: IPM.Post.)");
            }

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

            // Verify MS-OXWSATT requirement: MS-OXWSATT_R357
            // When the created attachment is returned successfully, this requirement can be captured.
            Site.CaptureRequirementIfAreEqual<ResponseClassType>(
                ResponseClassType.Success,
                getAttachmentInfoResponse.ResponseClass,
                357,
                @"[In t:ItemAttachmentType Complex Type][The type of PostItem element is] t:PostItemType ([MS-OXWSPOST] section 2.2.4.1)");

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

            // Verify MS-OXWSATT requirement: MS-OXWSATT_R99
            // When the created attachment is returned successfully, this requirement can be captured.
            Site.CaptureRequirementIfAreEqual<ResponseClassType>(
                ResponseClassType.Success,
                getAttachmentInfoResponse.ResponseClass,
                99,
                @"[In t:ItemAttachmentType Complex Type][The PostItem element] Represents a post item in the server store.");

            this.VerifyGetAttachmentSuccessfulResponse(getAttachmentResponse);

            #region Step 3 Delete the item attachment created in step 1 by the DeleteAttachment operation.

            DeleteAttachmentResponseType deleteAttachmentResponse = this.CallDeleteAttachmentOperation(createdAttachmentId);

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

            this.VerifyDeleteAttachmentSuccessfulResponse(deleteAttachmentResponse);

            #endregion
        }