/// <summary> /// Verify the CopyItemResponseType structure. /// </summary> /// <param name="copyItemResponse">The response got from server via CopyItem operation.</param> /// <param name="isSchemaValidated">The result of schema validation, true means valid.</param> private void VerifyCopyItemOperation(CopyItemResponseType copyItemResponse, bool isSchemaValidated) { // If the validation event return any error or warning, the schema validation is false, // which indicates the schema is not matched with the expected result. // So these requirement can be verified when the isSchemaValidation is true. // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSTASK_R148"); // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R148 Site.CaptureRequirementIfIsTrue( isSchemaValidated, 148, @"[In CopyItem Operation] The following is the WSDL port type specification for the CopyItem operation. <wsdl:operation name=""CopyItem""> <wsdl:input message=""tns:CopyItemSoapIn"" /> <wsdl:output message=""tns:CopyItemSoapOut"" /> </wsdl:operation>"); // Proxy handles operation's soap in and soap out, if the server didn't respond the soap out message for the operation, // proxy will fail. Now it didn't fail, that indicates server responds corresponding soap out message for the operation. // So the following requirement can be captured. // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSTASK_R150"); // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R150 Site.CaptureRequirementIfIsTrue( isSchemaValidated, 150, @"[In CopyItem Operation] The following is the WSDL binding specification for the CopyItem operation.<wsdl:operation name=""CopyItem""> <soap:operation soapAction=""http://schemas.microsoft.com/exchange/services/2006/messages/CopyItem""/> <wsdl:input> <soap:header message=""tns:CopyItemSoapIn"" part=""Impersonation"" use=""literal""/> <soap:header message=""tns:CopyItemSoapIn"" part=""MailboxCulture"" use=""literal""/> <soap:header message=""tns:CopyItemSoapIn"" part=""RequestVersion"" use=""literal""/> <soap:body parts=""request"" use=""literal""/> </wsdl:input> <wsdl:output> <soap:body parts=""CopyItemResult"" use=""literal""/> <soap:header message=""tns:CopyItemSoapOut"" part=""ServerVersion"" use=""literal""/> </wsdl:output> </wsdl:operation>"); if (copyItemResponse.ResponseMessages.Items != null && copyItemResponse.ResponseMessages.Items.Length > 0) { foreach (ItemInfoResponseMessageType itemInfo in copyItemResponse.ResponseMessages.Items) { if (itemInfo.ResponseClass == ResponseClassType.Success) { this.VerifyTaskType(isSchemaValidated, itemInfo); } } } }
/// <summary> /// Copy tasks on the server according to items' id. /// </summary> /// <param name="itemIds">The item id of tasks which will be copied.</param> /// <returns>The extracted items id array.</returns> protected ItemIdType[] CopyTasks(params ItemIdType[] itemIds) { // Define the CopyItem request. CopyItemType copyItemRequest = TestSuiteHelper.GenerateCopyItemRequest(itemIds); // Call the CopyItem method to copy the task items created in previous steps. CopyItemResponseType copyItemResponse = this.TASKAdapter.CopyItem(copyItemRequest); this.VerifyResponseMessage(copyItemResponse); // Save the ItemId of task item got from the CopyItem response. return(Common.GetItemIdsFromInfoResponse(copyItemResponse)); }
/// <summary> /// Copy contact item on the server. /// </summary> /// <param name="copyItemRequest">The request of CopyItem operation.</param> /// <returns>A response to CopyItem operation request.</returns> public CopyItemResponseType CopyItem(CopyItemType copyItemRequest) { CopyItemResponseType copyItemRespose = this.exchangeServiceBinding.CopyItem(copyItemRequest); #region Verify CopyItem operation requirements this.VerifySoapVersion(); this.VerifyTransportType(); this.VerifyCopyContactItem(this.exchangeServiceBinding.IsSchemaValidated); #endregion return(copyItemRespose); }
/// <summary> /// Verify the WSDL port type specifications for the CopyItem operation and CopyItemResponseType structure. /// </summary> /// <param name="response">The response message of CopyItem operation.</param> /// <param name="isSchemaValidated">The result of schema validation, true means valid.</param> private void VerifyCopyItemOperation(CopyItemResponseType response, bool isSchemaValidated) { Site.Assert.IsTrue(isSchemaValidated, "The schema validation should be true."); // Verify the WSDL port type specifications for the CopyItem operation // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R464"); // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R464 Site.CaptureRequirementIfIsTrue( isSchemaValidated, 464, @"[In CopyItem operation] The following is the WSDL port type specification for the CopyItem operation. <wsdl:operation name=""CopyItem""> <wsdl:input message=""tns:CopyItemSoapIn"" /> <wsdl:output message=""tns:CopyItemSoapOut"" /> </wsdl:operation>"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R597"); this.Site.CaptureRequirementIfIsTrue( isSchemaValidated, 597, @"[In CopyItem Operation] The following is the WSDL binding specification for the CopyItem operation. <wsdl:operation name=""CopyItem""> <soap:operation soapAction=""http://schemas.microsoft.com/exchange/services/2006/messages/CopyItem""/> <wsdl:input> <soap:header message=""tns:CopyItemSoapIn"" part=""Impersonation"" use=""literal""/> <soap:header message=""tns:CopyItemSoapIn"" part=""MailboxCulture"" use=""literal""/> <soap:header message=""tns:CopyItemSoapIn"" part=""RequestVersion"" use=""literal""/> <soap:body parts=""request"" use=""literal""/> </wsdl:input> <wsdl:output> <soap:body parts=""CopyItemResult"" use=""literal""/> <soap:header message=""tns:CopyItemSoapOut"" part=""ServerVersion"" use=""literal""/> </wsdl:output> </wsdl:operation>"); // Verify calendar related items foreach (ResponseMessageType responseMessage in response.ResponseMessages.Items) { if (responseMessage.ResponseClass == ResponseClassType.Success) { ItemInfoResponseMessageType itemInfo = responseMessage as ItemInfoResponseMessageType; ItemType item = itemInfo.Items.Items[0]; this.VerifyItemTypeItems(item, isSchemaValidated); } } }
/// <summary> /// Copy items and puts the items in a different folder. /// </summary> /// <param name="copyItemRequest">Specify a request to copy items on the server.</param> /// <returns>A response to CopyItem operation request.</returns> public CopyItemResponseType CopyItem(CopyItemType copyItemRequest) { CopyItemResponseType response = this.exchangeServiceBinding.CopyItem(copyItemRequest); Site.Assert.IsNotNull(response, "If the operation is successful, the response should not be null."); // SOAP version is set to 1.1, if a response can be received from server, then it means SOAP 1.1 is supported. this.VerifySoapVersion(); // Verify transport type related requirement. this.VerifyTransportType(); this.VerifyServerVersionInfo(this.exchangeServiceBinding.ServerVersionInfoValue, this.exchangeServiceBinding.IsSchemaValidated); this.VerifyCopyItemResponse(response, this.exchangeServiceBinding.IsSchemaValidated); return(response); }
/// <summary> /// Copy the calendar related item elements. /// </summary> /// <param name="request">A request to the CopyItem operation.</param> /// <returns>The response message returned by CopyItem operation.</returns> public CopyItemResponseType CopyItem(CopyItemType request) { if (request == null) { throw new ArgumentException("The request of operation 'CopyItem' should not be null."); } CopyItemResponseType copyItemResponse = this.exchangeServiceBinding.CopyItem(request); Site.Assert.IsNotNull(copyItemResponse, "If the operation is successful, the response should not be null."); this.VerifySoapVersion(); this.VerifyTransportType(); this.VerifyCopyItemOperation(copyItemResponse, this.exchangeServiceBinding.IsSchemaValidated); return(copyItemResponse); }
/// <summary> /// Verify the WSDL port type specifications for the CopyItem operation and CopyItemResponseType structure. /// </summary> /// <param name="copyItemResponse">The response got from server via CopyItem operation.</param> /// <param name="isSchemaValidated">The result of schema validation, true means valid.</param> private void VerifyCopyItemOperation(CopyItemResponseType copyItemResponse, bool isSchemaValidated) { // If the validation event returns any error or warning, the schema validation is false, // which indicates the schema is not matched with the expected result. // So this requirement can be verified when the isSchemaValidation is true. // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R202"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R202 Site.CaptureRequirementIfIsTrue( isSchemaValidated, 202, @"[In CopyItem] The following is the WSDL port type specification of the CopyItem operation. <wsdl:operation name=""CopyItem""> <wsdl:input message=""tns:CopyItemSoapIn"" /> <wsdl:output message=""tns:CopyItemSoapOut"" /> </wsdl:operation>"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R166"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R166 Site.CaptureRequirementIfIsTrue( isSchemaValidated, 166, @"[In CopyItem] The following is the WSDL binding specification of the CopyItem operation. <wsdl:operation name=""CopyItem""> <soap:operation soapAction=""http://schemas.microsoft.com/exchange/services/2006/messages/CopyItem"" /> <wsdl:input> <soap:header message=""tns:CopyItemSoapIn"" part=""Impersonation"" use=""literal""/> <soap:header message=""tns:CopyItemSoapIn"" part=""MailboxCulture"" use=""literal""/> <soap:header message=""tns:CopyItemSoapIn"" part=""RequestVersion"" use=""literal""/> <soap:body parts=""request"" use=""literal"" /> </wsdl:input> <wsdl:output> <soap:body parts=""CopyItemResult"" use=""literal"" /> <soap:header message=""tns:CopyItemSoapOut"" part=""ServerVersion"" use=""literal""/> </wsdl:output> </wsdl:operation>"); ItemInfoResponseMessageType item = copyItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; if (item.Items.Items[0] is MessageType) { MessageType messageItem = item.Items.Items[0] as MessageType; this.VerifyMessageType(messageItem, isSchemaValidated); } }
/// <summary> /// Copies Task items and puts the items in a different folder. /// </summary> /// <param name="copyItemRequest">Specifies a request to copy Task items on the server.</param> /// <returns>A response to this operation request.</returns> public CopyItemResponseType CopyItem(CopyItemType copyItemRequest) { CopyItemResponseType copyItemResponse = this.exchangeServiceBinding.CopyItem(copyItemRequest); Site.Assert.IsNotNull(copyItemResponse, "If the operation is successful, the response should not be null."); // Verify the copy item operation. this.VerifyCopyItemOperation(copyItemResponse, this.exchangeServiceBinding.IsSchemaValidated); // Verify Soap version requirements. this.VerifySoapVersion(); // Verify transport requirements. this.VerifyTransportType(); return(copyItemResponse); }
public void MSOXWSCORE_S08_TC02_CopyTypesOfItemsSuccessfully() { Site.Assume.IsTrue(Common.IsRequirementEnabled(19241, this.Site), "Exchange 2007 doesn't support MS-OXWSDLIST"); #region Step 1: Create Items. ItemIdType[] createdItemIds = CreateAllTypesItems(); #endregion #region Step 2: Copy items. CopyItemResponseType copyItemResponse = this.CallCopyItemOperation(DistinguishedFolderIdNameType.drafts, createdItemIds); // Check the operation response. Common.CheckOperationSuccess(copyItemResponse, createdItemIds.Length, this.Site); #endregion this.FindNewItemsInFolder(DistinguishedFolderIdNameType.drafts); }
public void MSOXWSCONT_S03_TC01_CopyContactItem() { #region Step 1:Create the contact item. // Create a contact item. ContactItemType item = this.BuildContactItemWithRequiredProperties(); CreateItemResponseType createItemResponse = this.CallCreateItemOperation(item); // Check the response. Common.CheckOperationSuccess(createItemResponse, 1, this.Site); #endregion #region Step 2:Copy the contact item. CopyItemType copyItemRequest = new CopyItemType(); CopyItemResponseType copyItemResponse = new CopyItemResponseType(); // Configure ItemIds. copyItemRequest.ItemIds = new BaseItemIdType[1]; copyItemRequest.ItemIds[0] = this.ExistContactItems[0]; // Configure the copy Distinguished Folder. DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType(); distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts; copyItemRequest.ToFolderId = new TargetFolderIdType(); copyItemRequest.ToFolderId.Item = distinguishedFolderIdForCopyItem; copyItemResponse = this.CONTAdapter.CopyItem(copyItemRequest); // Check the response. Common.CheckOperationSuccess(copyItemResponse, 1, this.Site); #endregion #region Step 3:Get the contact item. // The contact item to get. ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count]; this.ExistContactItems.CopyTo(itemArray, 0); GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray); // Check the response. Common.CheckOperationSuccess(getItemResponse, 2, this.Site); #endregion }
/// <summary> /// Moves the given message to the given folder. /// </summary> public void CopyMessageToFolder(ItemIdType messageId, string folderId) { var binding = ChannelHelper.BuildChannel(hostname, username, password); var request = new CopyItemType { ItemIds = new BaseItemIdType[] { messageId }, ToFolderId = new TargetFolderIdType { Item = new FolderIdType { Id = folderId } } }; CopyItemResponseType moveItemResponse = binding.CopyItem(request); if (moveItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error) { throw new Exception(moveItemResponse.ResponseMessages.Items[0].MessageText); } }
public void MSOXWSMTGS_S03_TC04_CopyItemErrorCalendarCannotMoveOrCopyOccurrence() { #region Define a recurring calendar item DateTime startTime = DateTime.Now; DailyRecurrencePatternType pattern = new DailyRecurrencePatternType(); pattern.Interval = this.PatternInterval; NumberedRecurrenceRangeType range = new NumberedRecurrenceRangeType(); range.NumberOfOccurrences = this.NumberOfOccurrences; range.StartDate = startTime; CalendarItemType calendarItem = new CalendarItemType(); calendarItem.UID = Guid.NewGuid().ToString(); calendarItem.Subject = this.Subject; calendarItem.Start = startTime; calendarItem.StartSpecified = true; calendarItem.End = startTime.AddHours(this.TimeInterval); calendarItem.EndSpecified = true; calendarItem.Recurrence = new RecurrenceType(); calendarItem.Recurrence.Item = pattern; calendarItem.Recurrence.Item1 = range; #endregion #region Create the recurring calendar item and extract the Id of an occurrence item ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, calendarItem, CalendarItemCreateOrDeleteOperationType.SendToNone); OccurrenceItemIdType occurrenceItemId = new OccurrenceItemIdType(); occurrenceItemId.ChangeKey = item.Items.Items[0].ItemId.ChangeKey; occurrenceItemId.RecurringMasterId = item.Items.Items[0].ItemId.Id; occurrenceItemId.InstanceIndex = this.InstanceIndex; #endregion #region Copy one occurrence of the recurring calendar item DistinguishedFolderIdType folderId = new DistinguishedFolderIdType(); folderId.Id = DistinguishedFolderIdNameType.drafts; TargetFolderIdType targetFolderId = new TargetFolderIdType(); targetFolderId.Item = folderId; CopyItemType copyItemRequest = new CopyItemType(); copyItemRequest.ItemIds = new BaseItemIdType[] { occurrenceItemId }; copyItemRequest.ToFolderId = targetFolderId; CopyItemResponseType response = this.MTGSAdapter.CopyItem(copyItemRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1190"); // Verify MS-OXWSMSG requirement: MS-OXWSMTGS_R1190 Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Error, response.ResponseMessages.Items[0].ResponseClass, 1190, @"[In Messages] If the request is unsuccessful, the CopyItem operation returns an CopyItemResponse element with the ResponseClass attribute of the CopyItemResponseMessage element set to ""Error"". "); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1193"); // Verify MS-OXWSMSG requirement: MS-OXWSMTGS_R1193 Site.CaptureRequirementIfAreEqual <ResponseCodeType>( ResponseCodeType.ErrorCalendarCannotMoveOrCopyOccurrence, response.ResponseMessages.Items[0].ResponseCode, 1193, @"[In Messages] ErrorCalendarCannotMoveOrCopyOccurrence: Specifies that an attempt was made to move or copy an occurrence of a recurring calendar item."); #endregion #region Clean up organizer's calendar folders. this.CleanupFoldersByRole(Role.Organizer, new List <DistinguishedFolderIdNameType>() { DistinguishedFolderIdNameType.calendar }); #endregion }
/// <summary> /// Verify the CopyItemResponseTypes structure. /// </summary> /// <param name="copyItemResponse">A CopyItemResponseType instance.</param> /// <param name="isSchemaValidated">Indicate whether schema is verified.</param> private void VerifyCopyItemResponse(CopyItemResponseType copyItemResponse, bool isSchemaValidated) { Site.Assert.IsTrue(isSchemaValidated, "The schema should be validated."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R222"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R222 Site.CaptureRequirementIfIsNotNull( copyItemResponse, 222, @"[In CopyItem Operation] The following is the WSDL port type specification for the CopyItem operation: <wsdl:operation name=""CopyItem"" xmlns:wsdl=""http://schemas.xmlsoap.org/wsdl/""> <wsdl:input message=""tns:CopyItemSoapIn"" /> <wsdl:output message=""tns:CopyItemSoapOut"" /> </wsdl:operation>"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R223"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R223 Site.CaptureRequirementIfIsNotNull( copyItemResponse, 223, @"[In CopyItem Operation] The following is the WSDL binding specification for the CopyItem operation: <wsdl:operation name=""CopyItem""> <soap:operation soapAction=""http://schemas.microsoft.com/exchange/services/2006/messages/CopyItem""/> <wsdl:input> <soap:header message=""tns:CopyItemSoapIn"" part=""Impersonation"" use=""literal""/> <soap:header message=""tns:CopyItemSoapIn"" part=""MailboxCulture"" use=""literal""/> <soap:header message=""tns:CopyItemSoapIn"" part=""RequestVersion"" use=""literal""/> <soap:body parts=""request"" use=""literal""/> </wsdl:input> <wsdl:output> <soap:body parts=""CopyItemResult"" use=""literal""/> <soap:header message=""tns:CopyItemSoapOut"" part=""ServerVersion"" use=""literal""/> </wsdl:output> </wsdl:operation>"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R237"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R237 Site.CaptureRequirementIfIsNotNull( copyItemResponse, 237, @"[In tns:CopyItemSoapOut Message] [The CopyItemSoapOut WSDL message is defined as:] <wsdl:message name=""CopyItemSoapOut""> <wsdl:part name=""CopyItemResult"" element=""tns:CopyItemResponse""/> <wsdl:part name=""ServerVersion"" element=""t:ServerVersionInfo""/> </wsdl:message>"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R248"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R248 // The schema is validated and the response of CopyItem operation is not null, so this requirement can be captured. Site.CaptureRequirementIfIsNotNull( copyItemResponse, 248, @"[In m:CopyItemResponse Element] [The CopyItemResponse element is defined as:] <xs:element name=""CopyItemResponse"" type=""m:CopyItemResponseType"" />"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R254"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R254 Site.CaptureRequirementIfIsNotNull( copyItemResponse, 254, @"[In m:CopyItemResponseType Complex Type] [The CopyItemResponseType complex type is defined as:] <xs:complexType name=""CopyItemResponseType""> <xs:complexContent> <xs:extension base=""m:BaseResponseMessageType"" /> </xs:complexContent> </xs:complexType>"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1404"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1404 Site.CaptureRequirementIfIsNotNull( copyItemResponse, 1404, @"[In tns:CopyItemSoapOut Message] The type of CopyItemResult is tns:CopyItemResponse (section 3.1.4.1.2.2)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R240"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R240 // According to the schema, copyItemResponse is the SOAP body of a response message returned by server, // this requirement can be verified directly. Site.CaptureRequirement( 240, @"[In tns:CopyItemSoapOut Message] [The part ""CopyItemResult""] Specifies the SOAP body of a response message."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1405"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1405 Site.CaptureRequirementIfIsNotNull( this.exchangeServiceBinding.ServerVersionInfoValue, 1405, @"[In tns:CopyItemSoapOut Message] The type of ServerVersion is t:ServerVersionInfo ([MS-OXWSCDATA] section 2.2.5.10)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R241"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R241 // According to the schema, ServerVersion is the SOAP header that contains the server version information, // this requirement can be verified directly. Site.CaptureRequirement( 241, @"[In tns:CopyItemSoapOut Message] [The part ""ServerVersion""] Specifies a SOAP header that identifies the server version for a response."); // Verify the BaseResponseMessageType schema. this.VerifyBaseResponseMessageType(copyItemResponse); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R220"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R220 // The request of CopyItem operation is formed according to schema // And the response of CopyItem operation is returned by server according to schema // This requirement can be verified directly. Site.CaptureRequirement( 220, @"[In Message Processing Events and Sequencing Rules] [The operation ""CopyItem""] Copies items on the server."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R221"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R221 // The request of CopyItem operation is formed according to schema // And the response of CopyItem operation is returned by server according to schema // This requirement can be verified directly. Site.CaptureRequirement( 221, @"[In CopyItem Operation] The CopyItem operation copies items on the server."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R244"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R244 // This requirement can be captured directly, since CopyItemResponse is the response of a CopyItem operation request. Site.CaptureRequirement( 244, @"[In Elements] [The element ""CopyItemResponse""] Specifies a response to a CopyItem operation request."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R247"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R247 // This requirement can be captured directly, since CopyItemResponse is the response of a CopyItem operation request. Site.CaptureRequirement( 247, @"[In m:CopyItemResponse Element] The CopyItemResponse element specifies a response to a CopyItem operation request."); foreach (ItemInfoResponseMessageType info in copyItemResponse.ResponseMessages.Items) { this.VerifyItemInfoResponseMessageType(info); } }
public void MSOXWSCORE_S01_TC22_ReturnNewItemIdsIsIgnored() { Site.Assume.IsTrue(Common.IsRequirementEnabled(1230, this.Site), "Exchange 2007 does not support the ReturnNewItemIds element."); #region Step 1: Create the item. ItemType item = new ItemType(); ItemIdType[] createdItemIdsForReturnNewItemIdsValueTrue = this.CreateItemWithMinimumElements(item); ItemIdType[] createdItemIdsForReturnNewItemIdsValueFalse = this.CreateItemWithMinimumElements(item); ItemIdType[] createdItemIdsForNoReturnNewItemIds = this.CreateItemWithMinimumElements(item); #endregion #region Step 2: Copy the item with ReturnNewItemIds element setting to true. CopyItemType copyItemRequest = new CopyItemType(); CopyItemResponseType copyItemResponse = new CopyItemResponseType(); copyItemRequest.ItemIds = createdItemIdsForReturnNewItemIdsValueTrue; DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType(); distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts; copyItemRequest.ToFolderId = new TargetFolderIdType(); copyItemRequest.ToFolderId.Item = distinguishedFolderIdForCopyItem; copyItemRequest.ReturnNewItemIds = true; copyItemRequest.ReturnNewItemIdsSpecified = true; copyItemResponse = this.COREAdapter.CopyItem(copyItemRequest); Common.CheckOperationSuccess(copyItemResponse, 1, this.Site); ItemIdType[] copiedItemIdsWithReturnNewItemIdsValueTrue = Common.GetItemIdsFromInfoResponse(copyItemResponse); Site.Assert.AreEqual<int>( 1, copiedItemIdsWithReturnNewItemIdsValueTrue.GetLength(0), "One copied item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, copiedItemIdsWithReturnNewItemIdsValueTrue.GetLength(0)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); bool isReturnNewIdsForReturnNewItemIdsTrue = !copiedItemIdsWithReturnNewItemIdsValueTrue[0].ChangeKey.Equals(createdItemIdsForReturnNewItemIdsValueTrue[0].ChangeKey, StringComparison.InvariantCultureIgnoreCase) || !copiedItemIdsWithReturnNewItemIdsValueTrue[0].Id.Equals(createdItemIdsForReturnNewItemIdsValueTrue[0].Id, StringComparison.InvariantCultureIgnoreCase); #endregion #region Step 3: Copy the item with ReturnNewItemIds element setting to false. copyItemRequest.ItemIds = createdItemIdsForReturnNewItemIdsValueFalse; copyItemRequest.ReturnNewItemIds = false; copyItemRequest.ReturnNewItemIdsSpecified = true; copyItemResponse = this.COREAdapter.CopyItem(copyItemRequest); Common.CheckOperationSuccess(copyItemResponse, 1, this.Site); ItemIdType[] copiedItemIdsWithReturnNewItemIdsValueFalse = Common.GetItemIdsFromInfoResponse(copyItemResponse); Site.Assert.AreEqual<int>( 1, copiedItemIdsWithReturnNewItemIdsValueFalse.GetLength(0), "One copied item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, copiedItemIdsWithReturnNewItemIdsValueFalse.GetLength(0)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); bool isReturnNewIdsForReturnNewItemIdsFalse = !copiedItemIdsWithReturnNewItemIdsValueFalse[0].ChangeKey.Equals(createdItemIdsForReturnNewItemIdsValueFalse[0].ChangeKey, StringComparison.InvariantCultureIgnoreCase) || !copiedItemIdsWithReturnNewItemIdsValueFalse[0].Id.Equals(createdItemIdsForReturnNewItemIdsValueFalse[0].Id, StringComparison.InvariantCultureIgnoreCase); #endregion #region Step 4: Copy the item without ReturnNewItemIds element. copyItemRequest.ItemIds = createdItemIdsForNoReturnNewItemIds; copyItemRequest.ReturnNewItemIdsSpecified = false; copyItemResponse = this.COREAdapter.CopyItem(copyItemRequest); Common.CheckOperationSuccess(copyItemResponse, 1, this.Site); ItemIdType[] copiedItemIdsWithoutReturnNewItemIds = Common.GetItemIdsFromInfoResponse(copyItemResponse); Site.Assert.AreEqual<int>( 1, copiedItemIdsWithoutReturnNewItemIds.GetLength(0), "One copied item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, copiedItemIdsWithoutReturnNewItemIds.GetLength(0)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); bool isReturnNewIdsForNoReturnNewItemIds = !copiedItemIdsWithoutReturnNewItemIds[0].ChangeKey.Equals(createdItemIdsForNoReturnNewItemIds[0].ChangeKey, StringComparison.InvariantCultureIgnoreCase) || !copiedItemIdsWithoutReturnNewItemIds[0].Id.Equals(createdItemIdsForNoReturnNewItemIds[0].Id, StringComparison.InvariantCultureIgnoreCase); Site.Assert.IsTrue( isReturnNewIdsForReturnNewItemIdsTrue == isReturnNewIdsForReturnNewItemIdsFalse && isReturnNewIdsForReturnNewItemIdsFalse == isReturnNewIdsForNoReturnNewItemIds, "New item id should be always returned or not for CopyItem regardless of wheter including ReturnNewItemIds element and the value for it."); #endregion #region Step 5: Move the item with ReturnNewItemIds element setting to true. createdItemIdsForReturnNewItemIdsValueTrue = this.CreateItemWithMinimumElements(item); createdItemIdsForReturnNewItemIdsValueFalse = this.CreateItemWithMinimumElements(item); createdItemIdsForNoReturnNewItemIds = this.CreateItemWithMinimumElements(item); MoveItemType moveItemRequest = new MoveItemType(); moveItemRequest.ItemIds = createdItemIdsForReturnNewItemIdsValueTrue; DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType(); distinguishedFolderId.Id = DistinguishedFolderIdNameType.inbox; moveItemRequest.ToFolderId = new TargetFolderIdType(); moveItemRequest.ToFolderId.Item = distinguishedFolderId; moveItemRequest.ReturnNewItemIds = true; moveItemRequest.ReturnNewItemIdsSpecified = true; MoveItemResponseType moveItemResponse = this.COREAdapter.MoveItem(moveItemRequest); Common.CheckOperationSuccess(moveItemResponse, 1, this.Site); ItemIdType[] movedItemIdsForReturnNewItemIdsValueTrue = Common.GetItemIdsFromInfoResponse(moveItemResponse); Site.Assert.AreEqual<int>( 1, movedItemIdsForReturnNewItemIdsValueTrue.GetLength(0), "One moved item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, movedItemIdsForReturnNewItemIdsValueTrue.GetLength(0)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); this.ExistItemIds.Remove(createdItemIdsForReturnNewItemIdsValueTrue[0]); isReturnNewIdsForReturnNewItemIdsTrue = !movedItemIdsForReturnNewItemIdsValueTrue[0].ChangeKey.Equals(createdItemIdsForReturnNewItemIdsValueTrue[0].ChangeKey, StringComparison.InvariantCultureIgnoreCase) || !movedItemIdsForReturnNewItemIdsValueTrue[0].Id.Equals(createdItemIdsForReturnNewItemIdsValueTrue[0].Id, StringComparison.InvariantCultureIgnoreCase); #endregion #region Step 6: Move the item with ReturnNewItemIds element setting to false. moveItemRequest.ItemIds = createdItemIdsForReturnNewItemIdsValueFalse; moveItemRequest.ReturnNewItemIds = false; moveItemRequest.ReturnNewItemIdsSpecified = true; moveItemResponse = this.COREAdapter.MoveItem(moveItemRequest); Common.CheckOperationSuccess(moveItemResponse, 1, this.Site); ItemIdType[] movedItemIdsForReturnNewItemIdsValueFalse = Common.GetItemIdsFromInfoResponse(moveItemResponse); Site.Assert.AreEqual<int>( 1, movedItemIdsForReturnNewItemIdsValueFalse.GetLength(0), "One moved item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, movedItemIdsForReturnNewItemIdsValueFalse.GetLength(0)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); this.ExistItemIds.Remove(createdItemIdsForReturnNewItemIdsValueFalse[0]); isReturnNewIdsForReturnNewItemIdsFalse = !movedItemIdsForReturnNewItemIdsValueFalse[0].ChangeKey.Equals(createdItemIdsForReturnNewItemIdsValueFalse[0].ChangeKey, StringComparison.InvariantCultureIgnoreCase) || !movedItemIdsForReturnNewItemIdsValueFalse[0].Id.Equals(createdItemIdsForReturnNewItemIdsValueFalse[0].Id, StringComparison.InvariantCultureIgnoreCase); #endregion #region Step 7: Move the item without ReturnNewItemIds element. moveItemRequest.ItemIds = createdItemIdsForNoReturnNewItemIds; moveItemRequest.ReturnNewItemIdsSpecified = false; moveItemResponse = this.COREAdapter.MoveItem(moveItemRequest); Common.CheckOperationSuccess(moveItemResponse, 1, this.Site); ItemIdType[] movedItemIdsForNoReturnNewItemIds = Common.GetItemIdsFromInfoResponse(moveItemResponse); Site.Assert.AreEqual<int>( 1, movedItemIdsForNoReturnNewItemIds.GetLength(0), "One moved item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, movedItemIdsForReturnNewItemIdsValueFalse.GetLength(0)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); this.ExistItemIds.Remove(createdItemIdsForNoReturnNewItemIds[0]); isReturnNewIdsForNoReturnNewItemIds = !movedItemIdsForNoReturnNewItemIds[0].ChangeKey.Equals(createdItemIdsForNoReturnNewItemIds[0].ChangeKey, StringComparison.InvariantCultureIgnoreCase) || !movedItemIdsForNoReturnNewItemIds[0].Id.Equals(createdItemIdsForNoReturnNewItemIds[0].Id, StringComparison.InvariantCultureIgnoreCase); Site.Assert.IsTrue( isReturnNewIdsForReturnNewItemIdsTrue == isReturnNewIdsForReturnNewItemIdsFalse && isReturnNewIdsForReturnNewItemIdsFalse == isReturnNewIdsForNoReturnNewItemIds, "New item id should be always returned or not for MoveItem regardless of wheter including ReturnNewItemIds element and the value for it."); if (Common.IsRequirementEnabled(1230, this.Site)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1230"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1230 // The ReturnNewItemId was set in the MoveItem and CopyItem request and the operations was executed successfully as above, so this requirement can be captured. this.Site.CaptureRequirement( 1230, @"[In Appendix C: Product Behavior] Implementation does introduce the ReturnNewItemIds element. (<45> Section 2.2.4.16: The ReturnNewItemIds element was introduced in Microsoft Exchange Server 2010 Service Pack 1 (SP1) (Exchange 2010 SP1 and above follow this behavior).)"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R47"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R47 // ReturnNewItemIds is ignored by server, this requirement can be covered. this.Site.CaptureRequirement( 47, @"[In m:BaseMoveCopyItemType Complex Type] [The element ""ReturnNewItemIds""] Specifies a Boolean return value that indicates whether the ItemId element is to be returned for new items."); } #endregion }
public void MSOXWSMTGS_S03_TC05_CopyItemErrorCalendarCannotUseIdForRecurringMasterId() { #region Define a meeting int timeInterval = this.TimeInterval; CalendarItemType calendarItem = new CalendarItemType(); calendarItem.UID = Guid.NewGuid().ToString(); calendarItem.Subject = this.Subject; calendarItem.Start = DateTime.UtcNow; calendarItem.StartSpecified = true; timeInterval++; calendarItem.End = DateTime.Now.AddHours(timeInterval); calendarItem.EndSpecified = true; calendarItem.Location = this.Location; calendarItem.RequiredAttendees = new AttendeeType[] { GetAttendeeOrResource(this.AttendeeEmailAddress) }; ItemInfoResponseMessageType item1 = this.CreateSingleCalendarItem(Role.Organizer, calendarItem, CalendarItemCreateOrDeleteOperationType.SendToAllAndSaveCopy); Site.Assert.IsNotNull(item1, "Server should return success for creating a recurring meeting."); CalendarItemType calendarInOrganizer = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.calendar, "IPM.Appointment", calendarItem.UID) as CalendarItemType; Site.Assert.IsNotNull(calendarInOrganizer, "The meeting should be found in organizer's Calendar folder after organizer calls CreateItem with CalendarItemCreateOrDeleteOperationType set to SendToAllAndSaveCopy."); #endregion #region Define a recurring calendar item DateTime startTime = DateTime.Now; DailyRecurrencePatternType pattern = new DailyRecurrencePatternType(); pattern.Interval = this.PatternInterval; NumberedRecurrenceRangeType range = new NumberedRecurrenceRangeType(); range.NumberOfOccurrences = this.NumberOfOccurrences; range.StartDate = startTime; CalendarItemType meetingItem = new CalendarItemType(); meetingItem.UID = Guid.NewGuid().ToString(); meetingItem.Subject = this.Subject; meetingItem.Start = startTime; meetingItem.StartSpecified = true; meetingItem.End = startTime.AddHours(this.TimeInterval); meetingItem.EndSpecified = true; meetingItem.Location = this.Location; meetingItem.Recurrence = new RecurrenceType(); meetingItem.Recurrence.Item = pattern; meetingItem.Recurrence.Item1 = range; meetingItem.RequiredAttendees = new AttendeeType[] { GetAttendeeOrResource(this.AttendeeEmailAddress) }; meetingItem.OptionalAttendees = new AttendeeType[] { GetAttendeeOrResource(this.OrganizerEmailAddress) }; meetingItem.Resources = new AttendeeType[] { GetAttendeeOrResource(this.RoomEmailAddress) }; #endregion #region Organizer creates a recurring calendar item with CalendarItemCreateOrDeleteOperationType value set to SendOnlyToAll CreateItemType createItemRequest = new CreateItemType(); createItemRequest.Items = new NonEmptyArrayOfAllItemsType(); createItemRequest.Items.Items = new ItemType[] { meetingItem }; createItemRequest.MessageDispositionSpecified = true; createItemRequest.MessageDisposition = MessageDispositionType.SaveOnly; createItemRequest.SendMeetingInvitationsSpecified = true; createItemRequest.SendMeetingInvitations = CalendarItemCreateOrDeleteOperationType.SendToNone; ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, meetingItem, CalendarItemCreateOrDeleteOperationType.SendOnlyToAll); #endregion #region Organizer copys the RecurringMasterId of the recurring calendar item #region Copy the recurring calendar item to Drafts folder through Id of recurring master getItem DistinguishedFolderIdType folderId = new DistinguishedFolderIdType(); folderId.Id = DistinguishedFolderIdNameType.drafts; TargetFolderIdType targetFolderId = new TargetFolderIdType(); targetFolderId.Item = folderId; OccurrenceItemIdType occurrenceId = new OccurrenceItemIdType(); occurrenceId.RecurringMasterId = calendarInOrganizer.ItemId.Id; occurrenceId.InstanceIndex = 1; CopyItemType copyItemRequest = new CopyItemType(); copyItemRequest.ItemIds = new BaseItemIdType[] { occurrenceId }; copyItemRequest.ToFolderId = targetFolderId; CopyItemResponseType response = this.MTGSAdapter.CopyItem(copyItemRequest); #endregion // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1223"); //Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1223 Site.CaptureRequirementIfAreEqual <ResponseCodeType>( ResponseCodeType.ErrorCalendarCannotUseIdForRecurringMasterId, response.ResponseMessages.Items[0].ResponseCode, 1223, @"[In Messages] ErrorCalendarCannotUseIdForRecurringMasterId: Specifies that the RecurringMasterId ([MS-OXWSCORE] section 2.2.4.35) does not correspond to a valid recurring master item."); #endregion #region Clean up organizer's calendar, sentitems and deleteditems folders and attendee's calendar, inbox and deleteditems folders. this.CleanupFoldersByRole(Role.Organizer, new List <DistinguishedFolderIdNameType> { DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.sentitems, DistinguishedFolderIdNameType.deleteditems }); this.CleanupFoldersByRole(Role.Attendee, new List <DistinguishedFolderIdNameType>() { DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.inbox, DistinguishedFolderIdNameType.deleteditems }); #endregion }
public void MSOXWSMSG_S06_TC01_OperateMultipleMessages() { #region Create multiple message string subject = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("Subject", Site), 0); string anotherSubject = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("Subject", Site), 1); CreateItemType createItemRequest = new CreateItemType { MessageDisposition = MessageDispositionType.SaveOnly, // MessageDispositionSpecified value needs to be set. MessageDispositionSpecified = true, SavedItemFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.drafts } }, Items = new NonEmptyArrayOfAllItemsType { // Create an responseMessageItem with two MessageType instances. Items = new MessageType[] { new MessageType { Sender = new SingleRecipientType { Item = new EmailAddressType { EmailAddress = this.Sender } }, ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } }, Subject = subject, }, new MessageType { Sender = new SingleRecipientType { Item = new EmailAddressType { EmailAddress = this.Sender } }, ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient2 } }, Subject = anotherSubject, } } }, }; CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(createItemResponse), @"Server should return success for creating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); // Save the first ItemId of message responseMessageItem got from the createItem response. Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); ItemIdType itemIdType1 = new ItemIdType(); itemIdType1.Id = this.firstItemOfFirstInfoItem.ItemId.Id; itemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; // Save the second ItemId. this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null."); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null."); ItemIdType itemIdType2 = new ItemIdType(); itemIdType2.Id = this.firstItemOfSecondInfoItem.ItemId.Id; itemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey; #endregion #region Get the multiple messages which created GetItemType getItemRequest = new GetItemType { // Set the two ItemIds got from CreateItem response. ItemIds = new ItemIdType[] { itemIdType1, itemIdType2 }, ItemShape = new ItemResponseShapeType { BaseShape = DefaultShapeNamesType.AllProperties, } }; GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(getItemResponse), @"Server should return success for creating the email messages."); #endregion #region Update the multiple messages which created UpdateItemType updateItemRequest = new UpdateItemType { MessageDisposition = MessageDispositionType.SaveOnly, // MessageDispositionSpecified value needs to be set. MessageDispositionSpecified = true, // Create two ItemChangeType instances. ItemChanges = new ItemChangeType[] { new ItemChangeType { Item = itemIdType1, Updates = new ItemChangeDescriptionType[] { new SetItemFieldType { Item = new PathToUnindexedFieldType { FieldURI = UnindexedFieldURIType.messageToRecipients }, // Update ToRecipients property of the first message. Item1 = new MessageType { ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient2 } } } }, } }, new ItemChangeType { Item = itemIdType2, Updates = new ItemChangeDescriptionType[] { new SetItemFieldType { Item = new PathToUnindexedFieldType { FieldURI = UnindexedFieldURIType.messageToRecipients }, // Update ToRecipients property of the second message. Item1 = new MessageType { ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } } } }, } } } }; UpdateItemResponseType updateItemResponse = this.MSGAdapter.UpdateItem(updateItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(updateItemResponse), @"Server should return success for updating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(updateItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); // Save the ItemId of the first message responseMessageItem got from the UpdateItem response. Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); itemIdType1.Id = this.firstItemOfFirstInfoItem.ItemId.Id; itemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; // Save the ItemId of the second message responseMessageItem got from the UpdateItem response. this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null."); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null."); itemIdType2.Id = this.firstItemOfSecondInfoItem.ItemId.Id; itemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey; #endregion #region Copy the updated multiple message to junkemail CopyItemType copyItemRequest = new CopyItemType { ItemIds = new ItemIdType[] { itemIdType1, itemIdType2, }, // Copy the message to junk email folder. ToFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.junkemail } } }; CopyItemResponseType copyItemResponse = this.MSGAdapter.CopyItem(copyItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(copyItemResponse), @"Server should return success for copying the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(copyItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); // Save the ItemId of the first message responseMessageItem got from the CopyItem response. Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); ItemIdType copyItemIdType1 = new ItemIdType(); copyItemIdType1.Id = this.firstItemOfFirstInfoItem.ItemId.Id; copyItemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; // Save the ItemId of the second message responseMessageItem got from the CopyItem response. this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null."); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null."); ItemIdType copyItemIdType2 = new ItemIdType(); copyItemIdType2.Id = this.firstItemOfSecondInfoItem.ItemId.Id; copyItemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey; #endregion #region Move the copied multiple message from junkemail to deleteditems MoveItemType moveItemRequest = new MoveItemType { // Set to copied message responseMessageItem id. ItemIds = new ItemIdType[] { copyItemIdType1, copyItemIdType2 }, // Move the copied messages to deleted items folder. ToFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.deleteditems } } }; MoveItemResponseType moveItemResponse = this.MSGAdapter.MoveItem(moveItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(moveItemResponse), @"Server should return success for moving the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(moveItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); // Save the ItemId of the first message responseMessageItem got from the MoveItem response. Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); copyItemIdType1.Id = this.firstItemOfFirstInfoItem.ItemId.Id; copyItemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; // Save the ItemId of the second message responseMessageItem got from the MoveItem response. this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null."); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null."); copyItemIdType2.Id = this.firstItemOfSecondInfoItem.ItemId.Id; copyItemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey; #endregion #region Send multiple messages SendItemType sendItemRequest = new SendItemType { // Set to the two updated messages' ItemIds. ItemIds = new ItemIdType[] { itemIdType1, itemIdType2 }, // Do not save copy. SaveItemToFolder = false, }; SendItemResponseType sendItemResponse = this.MSGAdapter.SendItem(sendItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(sendItemResponse), @"Server should return success for sending the email messages."); #endregion #region Delete the copied messages DeleteItemType deleteItemRequest = new DeleteItemType { // Set to the two copied messages' ItemIds. ItemIds = new ItemIdType[] { copyItemIdType1, copyItemIdType2 } }; DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(deleteItemResponse), @"Server should return success for deleting the email messages."); #endregion #region Clean up Recipient1's and Recipient2's inbox folders bool isClear = this.MSGSUTControlAdapter.CleanupFolders( Common.GetConfigurationPropertyValue("Recipient2", this.Site), Common.GetConfigurationPropertyValue("Recipient2Password", this.Site), this.Domain, subject, "inbox"); Site.Assert.IsTrue(isClear, "Recipient2's inbox folder should be cleaned up."); isClear = this.MSGSUTControlAdapter.CleanupFolders( Common.GetConfigurationPropertyValue("Recipient1", this.Site), Common.GetConfigurationPropertyValue("Recipient1Password", this.Site), this.Domain, anotherSubject, "inbox"); Site.Assert.IsTrue(isClear, "Recipient1's inbox folder should be cleaned up."); #endregion }
public void MSOXWSCORE_S01_TC02_CopyItemSuccessfully() { #region Step 1: Create the item. ItemType item = new ItemType(); ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item); #endregion #region Step 2: Copy the item. CopyItemType copyItemRequest = new CopyItemType(); CopyItemResponseType copyItemResponse = new CopyItemResponseType(); // Configure ItemIds. copyItemRequest.ItemIds = createdItemIds; // Configure copying item to draft folder. DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType(); distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts; copyItemRequest.ToFolderId = new TargetFolderIdType(); copyItemRequest.ToFolderId.Item = distinguishedFolderIdForCopyItem; copyItemResponse = this.COREAdapter.CopyItem(copyItemRequest); // Check the operation response. Common.CheckOperationSuccess(copyItemResponse, 1, this.Site); ItemIdType[] copiedItemIds = Common.GetItemIdsFromInfoResponse(copyItemResponse); // One copied item should be returned. Site.Assert.AreEqual<int>( 1, copiedItemIds.GetLength(0), "One copied item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, copiedItemIds.GetLength(0)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R253"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R253 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( copyItemResponse, 253, @"[In m:CopyItemResponseType Complex Type] The CopyItemResponseType complex type extends the BaseResponseMessageType complex type ([MS-OXWSCDATA] section 2.2.4.16)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1601"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1601 // The schema is validated, so this requirement can be captured. this.Site.CaptureRequirement( 1601, @"[In m:BaseMoveCopyItemType Complex Type] [The element ""ItemIds""] Specifies an array of elements of type BaseItemIdType that specifies a set of items to be copied."); ItemInfoResponseMessageType copyItemResponseMessage = copyItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1602"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1602 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( copyItemResponseMessage, "MS-OXWSCDATA", 1602, @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""CopyItemResponseMessage"" is ""m:ItemInfoResponseMessageType"" type."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1057"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1057 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( copyItemResponseMessage, "MS-OXWSCDATA", 1057, @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""CopyItemResponseMessage"" with type ""m:ItemInfoResponseMessageType"" specifies the response message for the CopyItem operation ([MS-OXWSCORE] section 3.1.4.1)."); #endregion #region Step 3: Get the first created item success. // Call the GetItem operation. GetItemResponseType getItemResponse = this.CallGetItemOperation(createdItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); ItemIdType[] getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); // One item should be returned. Site.Assert.AreEqual<int>( 1, getItemIds.GetLength(0), "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, getItemIds.GetLength(0)); #endregion #region Step 4: Get the second copied item success. // The Item properties returned. getItemResponse = this.CallGetItemOperation(copiedItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); // One item should be returned. Site.Assert.AreEqual<int>( 1, getItemIds.GetLength(0), "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, getItemIds.GetLength(0)); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1600"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1600 // If the copied item was got successfully, R1600 can be captured. this.Site.CaptureRequirement( 1600, @"[In m:BaseMoveCopyItemType Complex Type] [The element ""ToFolderId""] Specifies an instance of the TargetFolderIdType complex type that specifies the folder to which the items specified by the ItemIds property are to be copied."); #endregion }
public void MSOXWSCONT_S05_TC01_OperateMultipleContactItems() { #region Step 1:Create the contact item. CreateItemType createItemRequest = new CreateItemType(); #region Config the contact items createItemRequest.Items = new NonEmptyArrayOfAllItemsType(); createItemRequest.Items.Items = new ContactItemType[2]; // Create the first contact item. createItemRequest.Items.Items[0] = this.BuildContactItemWithRequiredProperties(); // Create the second contact item. createItemRequest.Items.Items[1] = this.BuildContactItemWithRequiredProperties(); // Configure the SavedItemFolderId of CreateItem request to specify that the created item is saved under which folder. createItemRequest.SavedItemFolderId = new TargetFolderIdType() { Item = new DistinguishedFolderIdType() { Id = DistinguishedFolderIdNameType.contacts, } }; #endregion CreateItemResponseType createItemResponse = this.CONTAdapter.CreateItem(createItemRequest); // Check the response. Common.CheckOperationSuccess(createItemResponse, 2, this.Site); #endregion #region Step 2:Update the contact items. UpdateItemType updateItemRequest = new UpdateItemType() { // Configure ItemIds. ItemChanges = new ItemChangeType[] { new ItemChangeType() { Item = this.ExistContactItems[0], Updates = new ItemChangeDescriptionType[] { new SetItemFieldType() { Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.contactsFileAs }, Item1 = new ContactItemType() { FileAs = FileAsMappingType.LastFirstCompany.ToString() } } } }, new ItemChangeType() { Item = this.ExistContactItems[1], Updates = new ItemChangeDescriptionType[] { new SetItemFieldType() { Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.contactsFileAs }, Item1 = new ContactItemType() { FileAs = FileAsMappingType.LastCommaFirst.ToString() } } } } }, ConflictResolution = ConflictResolutionType.AlwaysOverwrite }; // Clear existContactItems for MoveItem. this.InitializeCollection(); UpdateItemResponseType updateItemResponse = new UpdateItemResponseType(); // Invoke UpdateItem operation. updateItemResponse = this.CONTAdapter.UpdateItem(updateItemRequest); // Check the response. Common.CheckOperationSuccess(updateItemResponse, 2, this.Site); #endregion #region Step 3:Move the contact items. MoveItemType moveItemRequest = new MoveItemType(); MoveItemResponseType moveItemResponse = new MoveItemResponseType(); // Configure ItemIds. moveItemRequest.ItemIds = new BaseItemIdType[2]; moveItemRequest.ItemIds[0] = this.ExistContactItems[0]; moveItemRequest.ItemIds[1] = this.ExistContactItems[1]; // Clear existContactItems for MoveItem. this.InitializeCollection(); // Configure move Distinguished Folder. DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType(); distinguishedFolderId.Id = DistinguishedFolderIdNameType.drafts; moveItemRequest.ToFolderId = new TargetFolderIdType(); moveItemRequest.ToFolderId.Item = distinguishedFolderId; moveItemResponse = this.CONTAdapter.MoveItem(moveItemRequest); // Check the response. Common.CheckOperationSuccess(moveItemResponse, 2, this.Site); #endregion #region Step 4:Get the contact items. // The contact item to get. ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count]; this.ExistContactItems.CopyTo(itemArray, 0); GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray); // Check the response. Common.CheckOperationSuccess(getItemResponse, 2, this.Site); #endregion #region Step 5:Copy the contact items. CopyItemType copyItemRequest = new CopyItemType(); CopyItemResponseType copyItemResponse = new CopyItemResponseType(); // Configure ItemIds. copyItemRequest.ItemIds = new BaseItemIdType[2]; copyItemRequest.ItemIds[0] = this.ExistContactItems[0]; copyItemRequest.ItemIds[1] = this.ExistContactItems[1]; // Configure the copy Distinguished Folder. DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType(); distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts; copyItemRequest.ToFolderId = new TargetFolderIdType(); copyItemRequest.ToFolderId.Item = distinguishedFolderIdForCopyItem; copyItemResponse = this.CONTAdapter.CopyItem(copyItemRequest); // Check the response. Common.CheckOperationSuccess(copyItemResponse, 2, this.Site); #endregion }
public void MSOXWSCONT_S06_TC01_OperateContactItemWithoutOptionalElements() { #region Step 1:Create the contact item. // Create a contact item without optional elements. ContactItemType item = this.BuildContactItemWithRequiredProperties(); CreateItemResponseType createItemResponse = this.CallCreateItemOperation(item); // Check the response. Common.CheckOperationSuccess(createItemResponse, 1, this.Site); #endregion #region Step 2:Update the contact item. UpdateItemType updateItemRequest = new UpdateItemType() { // Configure ItemIds. ItemChanges = new ItemChangeType[] { new ItemChangeType() { Item = this.ExistContactItems[0], Updates = new ItemChangeDescriptionType[] { new SetItemFieldType() { Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.contactsFileAs }, Item1 = new ContactItemType() { FileAs = FileAsMappingType.LastFirstCompany.ToString() } } } } }, ConflictResolution = ConflictResolutionType.AlwaysOverwrite }; // Clear existContactItems for MoveItem. this.InitializeCollection(); UpdateItemResponseType updateItemResponse = new UpdateItemResponseType(); // Invoke UpdateItem operation. updateItemResponse = this.CONTAdapter.UpdateItem(updateItemRequest); // Check the response. Common.CheckOperationSuccess(updateItemResponse, 1, this.Site); #endregion #region Step 3:Move the contact item. MoveItemType moveItemRequest = new MoveItemType(); MoveItemResponseType moveItemResponse = new MoveItemResponseType(); // Configure ItemIds. moveItemRequest.ItemIds = new BaseItemIdType[1]; moveItemRequest.ItemIds[0] = this.ExistContactItems[0]; // Clear existContactItems for MoveItem. this.InitializeCollection(); // Configure move Distinguished Folder. DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType(); distinguishedFolderId.Id = DistinguishedFolderIdNameType.drafts; moveItemRequest.ToFolderId = new TargetFolderIdType(); moveItemRequest.ToFolderId.Item = distinguishedFolderId; moveItemResponse = this.CONTAdapter.MoveItem(moveItemRequest); // Check the response. Common.CheckOperationSuccess(moveItemResponse, 1, this.Site); #endregion #region Step 4:Get the contact item. // The contact item to get. ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count]; this.ExistContactItems.CopyTo(itemArray, 0); GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray); // Check the response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); #endregion #region Step 5:Copy the contact item. CopyItemType copyItemRequest = new CopyItemType(); CopyItemResponseType copyItemResponse = new CopyItemResponseType(); // Configure ItemIds. copyItemRequest.ItemIds = new BaseItemIdType[1]; copyItemRequest.ItemIds[0] = this.ExistContactItems[0]; // Configure the copy Distinguished Folder. DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType(); distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts; copyItemRequest.ToFolderId = new TargetFolderIdType(); copyItemRequest.ToFolderId.Item = distinguishedFolderIdForCopyItem; copyItemResponse = this.CONTAdapter.CopyItem(copyItemRequest); // Check the response. Common.CheckOperationSuccess(copyItemResponse, 1, this.Site); #endregion }
public void MSOXWSMSG_S03_TC02_CopyMessageUnsuccessful() { #region Create message CreateItemType createItemRequest = GetCreateItemType(MessageDispositionType.SaveOnly, DistinguishedFolderIdNameType.drafts); CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest); Site.Assert.IsTrue(this.VerifyCreateItemResponse(createItemResponse, MessageDispositionType.SaveOnly), @"Server should return success for creating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); // Save the ItemId of message responseMessageItem got from the createItem response. ItemIdType itemIdType = new ItemIdType(); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); itemIdType.Id = this.firstItemOfFirstInfoItem.ItemId.Id; itemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; #endregion #region Delete the message created DeleteItemType deleteItemRequest = new DeleteItemType { ItemIds = new ItemIdType[] { this.firstItemOfFirstInfoItem.ItemId } }; DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest); Site.Assert.IsTrue(this.VerifyResponse(deleteItemResponse), @"Server should return success for deleting the email messages."); #endregion #region Copy message deleted CopyItemType copyItemRequest = new CopyItemType { ItemIds = new ItemIdType[] { itemIdType }, // Save the copy message to inbox folder. ToFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.inbox } } }; CopyItemResponseType copyItemResponse = this.MSGAdapter.CopyItem(copyItemRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R170001"); this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Error, copyItemResponse.ResponseMessages.Items[0].ResponseClass, 170001, @"[In CopyItem] If the CreateItem WSDL operation is not successful, it returns a CreateItemResponse element with the ResponseClass attribute of the CreateItemResponseMessage element set to ""Error"". "); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R170002"); this.Site.CaptureRequirementIfIsTrue( System.Enum.IsDefined(typeof(ResponseCodeType), copyItemResponse.ResponseMessages.Items[0].ResponseCode), 170002, @"[In CopyItem] [A unsuccessful CopyItem operation request returns a CopyItemResponse element] The ResponseCode element of the CreateItemResponseMessage element is set to one of the common errors defined in [MS-OXWSCDATA] section 2.2.5.24."); #endregion }
public void MSOXWSMSG_S03_TC01_CopyMessage() { #region Create message CreateItemType createItemRequest = GetCreateItemType(MessageDispositionType.SaveOnly, DistinguishedFolderIdNameType.drafts); CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest); Site.Assert.IsTrue(this.VerifyCreateItemResponse(createItemResponse, MessageDispositionType.SaveOnly), @"Server should return success for creating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); // Save the ItemId of message responseMessageItem got from the createItem response. ItemIdType itemIdType = new ItemIdType(); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); itemIdType.Id = this.firstItemOfFirstInfoItem.ItemId.Id; itemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; #endregion #region Copy message CopyItemType copyItemRequest = new CopyItemType { ItemIds = new ItemIdType[] { itemIdType }, // Save the copy message to inbox folder. ToFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.inbox } } }; CopyItemResponseType copyItemResponse = this.MSGAdapter.CopyItem(copyItemRequest); Site.Assert.IsTrue(this.VerifyResponse(copyItemResponse), @"Server should return success for copying the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(copyItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type from server response should not be null."); // Save the ItemId of message responseMessageItem got from the copyItem response. ItemIdType copyItemIdType = new ItemIdType(); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); copyItemIdType.Id = this.firstItemOfFirstInfoItem.ItemId.Id; copyItemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; #region Verify the requirements about CopyItem // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R168"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R168 Site.CaptureRequirementIfIsNotNull( copyItemResponse, 168, @"[In CopyItem] The protocol client sends a CopyItemSoapIn request WSDL message, and the protocol server responds with a CopyItemSoapOut response WSDL message."); Site.Assert.IsNotNull(this.infoItems[0].ResponseClass, @"The ResponseClass property of the first item of infoItems instance should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R169"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R169 Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, copyItemResponse.ResponseMessages.Items[0].ResponseClass, 169, @"[In CopyItem] If the CreateItem WSDL operation request is successful, the server returns a CreateItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.2.2.2, with the ResponseClass attribute, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the CreateItemResponseMessage element, as specified in [MS-OXWSCDATA] section 2.2.4.12, set to ""Success"". "); Site.Assert.IsNotNull(this.infoItems[0].ResponseCode, @"The ResponseCode property of the first item of infoItems instance should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R170"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R170 Site.CaptureRequirementIfAreEqual <ResponseCodeType>( ResponseCodeType.NoError, copyItemResponse.ResponseMessages.Items[0].ResponseCode, 170, @"[In CopyItem] [A successful CopyItem operation request returns a CopyItemResponse element] The ResponseCode element, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the CreateItemResponseMessage element is set to ""NoError"". "); #endregion #endregion #region Delete the copied Email messages DeleteItemType deleteItemRequest = new DeleteItemType { ItemIds = new ItemIdType[] { itemIdType, copyItemIdType } }; DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(deleteItemResponse), @"Server should return success for deleting the email messages."); #endregion }
public void MSOXWSCORE_S07_TC02_CopyTaskItemSuccessfully() { #region Step 1: Create the task item. TaskType item = new TaskType(); ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item); #endregion #region Step 2: Copy the task item. // Call CopyItem operation. CopyItemResponseType copyItemResponse = this.CallCopyItemOperation(DistinguishedFolderIdNameType.drafts, createdItemIds); // Check the operation response. Common.CheckOperationSuccess(copyItemResponse, 1, this.Site); ItemIdType[] copiedItemIds = Common.GetItemIdsFromInfoResponse(copyItemResponse); // One copied task item should be returned. Site.Assert.AreEqual <int>( 1, copiedItemIds.GetLength(0), "One copied task item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, copiedItemIds.GetLength(0)); #endregion #region Step 3: Get the first created task item success. // Call the GetItem operation. GetItemResponseType getItemResponse = this.CallGetItemOperation(createdItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); ItemIdType[] getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); // One task item should be returned. Site.Assert.AreEqual <int>( 1, getItemIds.GetLength(0), "One task item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, getItemIds.GetLength(0)); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2021"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2021 this.Site.CaptureRequirementIfAreEqual <string>( "IPM.Task", ((ItemInfoResponseMessageType)getItemResponse.ResponseMessages.Items[0]).Items.Items[0].ItemClass, 2021, @"[In t:ItemType Complex Type] This value is ""IPM.Task"" for task item."); #endregion #region Step 4: Get the second copied task item success. // Call the GetItem operation. getItemResponse = this.CallGetItemOperation(copiedItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); // One task item should be returned. Site.Assert.AreEqual <int>( 1, getItemIds.GetLength(0), "One task item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, getItemIds.GetLength(0)); #endregion }
public void MSOXWSCORE_S03_TC02_CopyDistributionListsItemSuccessfully() { Site.Assume.IsTrue(Common.IsRequirementEnabled(19241, this.Site), "Exchange 2007 doesn't support MS-OXWSDLIST"); #region Step 1: Create the distribution list type item. DistributionListType item = new DistributionListType(); ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item); #endregion #region Step 2: Copy the distribution list type item. // Call CopyItem operation. CopyItemResponseType copyItemResponse = this.CallCopyItemOperation(DistinguishedFolderIdNameType.drafts, createdItemIds); // Check the operation response. Common.CheckOperationSuccess(copyItemResponse, 1, this.Site); ItemIdType[] copiedItemIds = Common.GetItemIdsFromInfoResponse(copyItemResponse); // One copied distribution list type item should be returned. Site.Assert.AreEqual <int>( 1, copiedItemIds.GetLength(0), "One copied distribution list type item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, copiedItemIds.GetLength(0)); #endregion #region Step 3: Get the first created distribution list type item success. // Call the GetItem operation. GetItemResponseType getItemResponse = this.CallGetItemOperation(createdItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); ItemIdType[] getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); // One distribution list type item should be returned. Site.Assert.AreEqual <int>( 1, getItemIds.GetLength(0), "One distribution list type item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, getItemIds.GetLength(0)); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2022"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2022 this.Site.CaptureRequirementIfAreEqual <string>( "IPM.DistList", ((ItemInfoResponseMessageType)getItemResponse.ResponseMessages.Items[0]).Items.Items[0].ItemClass, 2022, @"[In t:ItemType Complex Type] This value is ""IPM.DistList"" for distribution list item."); #endregion #region Step 4: Get the second copied distribution list type item success. // Call the GetItem operation. getItemResponse = this.CallGetItemOperation(copiedItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); // One distribution list type item should be returned. Site.Assert.AreEqual <int>( 1, getItemIds.GetLength(0), "One distribution list type item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, getItemIds.GetLength(0)); #endregion }