/// <summary> /// Get the UploadItemsResponseMessageType response of UploadItems operation when this operation executes successfully. /// </summary> /// <param name="exportedItems">The items exported from server.</param> /// <param name="parentFolderId">Specifies the target folder in which to place the upload item.</param> /// <param name="createAction">Specifies the action for uploading items to the folder.</param> /// <param name="isAssociatedSpecified">A Boolean value specifies whether IsAssociated attribute is specified.</param> /// <param name="isAssociated">Specifies the value of the IsAssociated attribute.</param> /// <param name="configureSOAPHeader">A Boolean value specifies whether configuring the SOAP header before calling operations.</param> /// <returns>The array of UploadItemsResponseMessageType response.</returns> protected UploadItemsResponseMessageType[] UploadItems( ExportItemsResponseMessageType[] exportedItems, Collection<string> parentFolderId, CreateActionType createAction, bool isAssociatedSpecified, bool isAssociated, bool configureSOAPHeader) { #region Call UploadItems operation to upload the items that exported in last step to the server. // Initialize the upload items using the data of previous exported items, and set that item CreateAction to a value of CreateActionType. UploadItemsType uploadItems = new UploadItemsType(); uploadItems.Items = new UploadItemType[this.ItemCount]; for (int i = 0; i < uploadItems.Items.Length; i++) { uploadItems.Items[i] = TestSuiteHelper.GenerateUploadItem( exportedItems[i].ItemId.Id, exportedItems[i].ItemId.ChangeKey, exportedItems[i].Data, parentFolderId[i], createAction); uploadItems.Items[i].IsAssociatedSpecified = isAssociatedSpecified; if (uploadItems.Items[i].IsAssociatedSpecified) { uploadItems.Items[i].IsAssociated = isAssociated; } } // Call UploadItems operation. UploadItemsResponseType uploadItemsResponse = this.BTRFAdapter.UploadItems(uploadItems); // Check whether the operation is executed successfully. foreach (UploadItemsResponseMessageType uploadResponse in uploadItemsResponse.ResponseMessages.Items) { Site.Assert.AreEqual<ResponseClassType>( ResponseClassType.Success, uploadResponse.ResponseClass, string.Format( @"The UploadItems operation should be successful. Expected response code: {0}, actual response code: {1}", ResponseClassType.Error, uploadResponse.ResponseClass)); } // If the operation executes successfully, the items in UploadItems response should be equal to the value of ItemCount Site.Assert.AreEqual<int>( uploadItemsResponse.ResponseMessages.Items.Length, this.ItemCount, string.Format( "The uploadItems response should contain {0} items, actually, it contains {1}", this.ItemCount, uploadItemsResponse.ResponseMessages.Items.Length)); #endregion #region Verify the UploadItemsResponseType related requirements // Verify the UploadItemsResponseType related requirements. this.VerifyUploadItemsSuccessResponse(uploadItemsResponse); #endregion #region Call GetResponseMessages to get the UploadItemsResponseMessageType items. // Get the UploadItemsResponseMessageType items. UploadItemsResponseMessageType[] uploadItemsResponseMessages = TestSuiteHelper.GetResponseMessages<UploadItemsResponseMessageType>(uploadItemsResponse); return uploadItemsResponseMessages; #endregion }
/// <summary> /// This method is used to verify the ExportItemsResponseMessageType related requirements. /// </summary> /// <param name="exportItemsMessage">Specified ExportItemsResponseMessageType instance.</param> /// <param name="isSchemaValidated">Whether the schema is validated.</param> private void VerifyExportItemsResponseMessageType(ExportItemsResponseMessageType exportItemsMessage, bool isSchemaValidated) { // Verify the base type ResponseMessageType related requirements. this.VerifyResponseMessageType(exportItemsMessage as ResponseMessageType, isSchemaValidated); // If the schema validation and the above base type verification are successful, then MS-OXWSBTRF_R70, MS-OXWSBTRF_R168 and MS-OXWSBTRF_R171 can be captured. // Add debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSBTRF_R168"); // Verify MS-OXWSBTRF requirement: MS-OXWSBTRF_R168 Site.CaptureRequirementIfIsTrue( isSchemaValidated, 168, @"[In m:ExportItemsResponseMessageType Complex Type]The type of ItemId is t:ItemIdType ([MS-OXWSCORE] section 2.2.4.25)."); // Add debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSBTRF_R70"); // Verify MS-OXWSBTRF requirement: MS-OXWSBTRF_R70 Site.CaptureRequirementIfIsTrue( isSchemaValidated, 70, @"[In m:ExportItemsResponseMessageType Complex Type][The schema of ExportItemsResponseMessageType is:]<xs:complexType name=""ExportItemsResponseMessageType""><xs:complexContent><xs:extension base=""m:ResponseMessageType""><xs:sequence><xs:element name=""ItemId""type=""t:ItemIdType"" minOccurs=""0"" maxOccurs=""1""/> <xs:element name=""Data"" type=""xs:base64Binary"" minOccurs=""0"" maxOccurs=""1""/></xs:sequence> </xs:extension></xs:complexContent></xs:complexType>"); // Add debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSBTRF_R171"); // Verify MS-OXWSBTRF requirement: MS-OXWSBTRF_R171 Site.CaptureRequirementIfIsTrue( isSchemaValidated, 171, @"[In m:ExportItemsResponseMessageType Complex Type]The type of Data is xs:base64Binary ([XMLSCHEMA2])."); }