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

MSOXWSATT_S01_TC14_GetUnsupportedMimeConversionAttachment() private method

        public void MSOXWSATT_S01_TC14_GetUnsupportedMimeConversionAttachment()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(552, this.Site), "Implementation does return ErrorUnsupportedMimeConversion response code when the IncludeMimeContent element is set to true and the attachment is not one of the accepted item classes.");

            #region Step 1 Create a Task attachment on an item.
            // Create a file attachment by CreateAttachment operation.
            CreateAttachmentResponseType createAttachmentResponse = this.CallCreateAttachmentOperation(this.ItemId.Id, AttachmentTypeValue.TaskAttachment);
            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 Task attahcment and the IncludeMimeContent element is set to true.
            GetAttachmentResponseType getAttachmentResponse = this.CallGetAttachmentOperation(BodyTypeResponseType.Text, true, createdAttachmentId);
            
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSATT_R552");

            this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>(
                ResponseCodeType.ErrorUnsupportedMimeConversion,
                getAttachmentResponse.ResponseMessages.Items[0].ResponseCode,
                552,
                @"[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 and the attachment is not one of the accepted item classes [IPM.Note, IPM.Post, IPM.Appointment], the GetAttachmentResponseMessage element MUST return an ErrorUnsupportedMimeConversion response code as specified in [MS-OXWSCDATA] section 2.2.5.24.)");

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

            // If R443 and R446 are verified, then R510001 will be verified.
            this.Site.CaptureRequirement(
                "MS-OXWSCDATA",
                713,
                @"[In m:ResponseCodeType Simple Type] The value ""ErrorUnsupportedMimeConversion"" occurs when you are trying to retrieve or set MIME content for an item other than a PostItemType, MessageType, or CalendarItemType object.");
             #endregion

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