public void MSOXWSCORE_S01_TC37_LastModifiedNameIsReadOnly() { #region Create an item with setting LastModifiedName ItemType[] createdItems = new ItemType[] { new ItemType() }; createdItems[0].Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForCreateItem); createdItems[0].LastModifiedName = Common.GenerateResourceName(this.Site, "LastModifiedName"); CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.drafts, createdItems); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2039"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2039 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorInvalidPropertySet, createItemResponse.ResponseMessages.Items[0].ResponseCode, 2039, @"[In t:ItemType Complex Type] This element [LastModifiedName] is read-only."); #endregion #region Update an item with setting LastModifiedName ItemType item = new ItemType(); ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item); UpdateItemResponseType updateItemResponse; ItemChangeType[] itemChanges; itemChanges = new ItemChangeType[1]; itemChanges[0] = new ItemChangeType(); // Update the created item. itemChanges[0].Item = createdItemIds[0]; itemChanges[0].Updates = new ItemChangeDescriptionType[1]; SetItemFieldType setItem = new SetItemFieldType(); setItem.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemLastModifiedName }; setItem.Item1 = new ItemType() { LastModifiedName = Common.GenerateResourceName(this.Site, "LastModifiedName") }; itemChanges[0].Updates[0] = setItem; updateItemResponse = this.CallUpdateItemOperation( DistinguishedFolderIdNameType.drafts, true, itemChanges); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2277"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2277 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorInvalidPropertySet, updateItemResponse.ResponseMessages.Items[0].ResponseCode, 2277, @"[In t:ItemType Complex Type] but if [LastModifiedName] specified in a CreateItem or UpdateItem request, an ErrorInvalidPropertySet ([MS-OXWSCDATA] section 2.2.5.24) will be returned."); #endregion }
public void MSOXWSMSG_S01_TC05_GetAndDeleteMessageUnsuccessful() { #region Create a message with all elements except ReceivedBy and ReceivedRepresenting elements 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); #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 Get the created message via itemIdType in above steps GetItemType getItemRequest = DefineGeneralGetItemRequestMessage(this.firstItemOfFirstInfoItem.ItemId, DefaultShapeNamesType.IdOnly); GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R135001"); this.Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Error, getItemResponse.ResponseMessages.Items[0].ResponseClass, 135001, @"[In GetItem] If the GetItem WSDL operation request is not successful, it returns a GetItemResponse element with the ResponseClass attribute of the GetItemResponseMessage element set to ""Error"". "); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R135002"); this.Site.CaptureRequirementIfIsTrue( System.Enum.IsDefined(typeof(ResponseCodeType), getItemResponse.ResponseMessages.Items[0].ResponseCode), 135002, @"[In GetItem] [A unsuccessful GetItem operation request returns a GetItemResponse element] The ResponseCode element of the GetItemResponseMessage element is set to one of the common errors defined in [MS-OXWSCDATA] section 2.2.5.24."); #endregion #region Delete the message deleted. ItemIdType itemId = new ItemIdType() { Id = this.firstItemOfFirstInfoItem.ItemId.Id + "invalid", ChangeKey = this.firstItemOfFirstInfoItem.ItemId.Id, }; deleteItemRequest.ItemIds = new ItemIdType[] { itemId }; deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest); this.Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Error, deleteItemResponse.ResponseMessages.Items[0].ResponseClass, 154001, @"[In DeleteItem] If the DeleteItem WSDL operation request is not successful, it returns a DeleteItemResponse element with the ResponseClass attribute of the DeleteItemResponseMessage element set to ""Error"". "); this.Site.CaptureRequirementIfIsTrue( System.Enum.IsDefined(typeof(ResponseCodeType), deleteItemResponse.ResponseMessages.Items[0].ResponseCode), 154002, @"[In DeleteItem] [A unsuccessful DeleteItem operation request returns a DeleteItemResponse element] The ResponseCode element of the DeleteItemResponseMessage element is set to one of the common errors defined in [MS-OXWSCDATA] section 2.2.5.24."); #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 MSOXWSMSG_S01_TC07_GetMessageWithFilterHtmlContent() { Site.Assume.IsTrue(Common.GetConfigurationPropertyValue("SutVersion", this.Site).Equals("ExchangeServer2007") == false, "Exchange 2007 does not use the FilterHtmlContent element."); #region Create a message with html body #region Define a CreateItem request string unsafeHtmlContent = "<html><body><b>Bold</b><script>alert('Alert!');</script></body></html>"; CreateItemType createItemRequest = new CreateItemType { MessageDisposition = MessageDispositionType.SaveOnly, // MessageDispositionSpecified value needs to be set. MessageDispositionSpecified = true, SavedItemFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.drafts } }, // Define the message which contains all the elements except ReceivedBy and ReceivedRepresenting. Items = new NonEmptyArrayOfAllItemsType { Items = new MessageType[] { // Create a MessageType instance with all element. new MessageType { // Specify the recipient of the message. ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } }, // Specify the subject of message. Subject = this.Subject, Body = new BodyType() { BodyType1 = BodyTypeType.HTML, Value = unsafeHtmlContent, } } } }, }; #endregion 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); #endregion #region Get the created message via itemIdType in above steps #region Send the GetItem requst which the FilterHtmlContent is set true. GetItemType getItemRequest = new GetItemType { ItemIds = new ItemIdType[] { this.firstItemOfFirstInfoItem.ItemId }, ItemShape = new ItemResponseShapeType { BaseShape = DefaultShapeNamesType.AllProperties, FilterHtmlContent = true, FilterHtmlContentSpecified = true, } }; GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), "The response of the GetItem should be valid."); MessageType message = ((ItemInfoResponseMessageType)getItemResponse.ResponseMessages.Items[0]).Items.Items[0] as MessageType; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R21193"); this.Site.CaptureRequirementIfIsFalse( message.Body.Value.Contains("<script>alert('Alert!');</script>"), "MS-OXWSCDATA", 21193, @"[In t:ItemResponseShapeType Complex Type] [FilterHtmlContent is] True, specifies HTML content filtering is enabled."); #endregion #region Send the GetItem requst which the FilterHtmlContent is set false. getItemRequest.ItemShape.FilterHtmlContent = false; getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), @"Server should return success for getting the email messages."); message = ((ItemInfoResponseMessageType)getItemResponse.ResponseMessages.Items[0]).Items.Items[0] as MessageType; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R21194"); this.Site.CaptureRequirementIfIsTrue( message.Body.Value.Contains("<script>alert('Alert!');</script>"), "MS-OXWSCDATA", 21194, @"[In t:ItemResponseShapeType Complex Type] otherwise [FilterHtmlContent is] false, specifies [HTML content filtering is not enabled]."); #endregion #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 }
public void MSOXWSMSG_S01_TC01_CreateGetDeleteMessageWithAllElementsExceptAboutDelegate() { #region Create a message with all elements except ReceivedBy and ReceivedRepresenting elements #region Define a CreateItem request CreateItemType createItemRequest = new CreateItemType { MessageDisposition = MessageDispositionType.SaveOnly, // MessageDispositionSpecified value needs to be set. MessageDispositionSpecified = true, SavedItemFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.drafts } }, // Define the message which contains all the elements except ReceivedBy and ReceivedRepresenting. Items = new NonEmptyArrayOfAllItemsType { Items = new MessageType[] { // Create a MessageType instance with all element. new MessageType { // Specify the recipient of the message. ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } }, // Specify the recipient that receives a carbon copy of the message. CcRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient2 } }, // Specify the recipient that receives a blind carbon copy of the message. BccRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.MeetingRoom } }, // Specify the subject of message. Subject = this.Subject, // The sender of message requests a read receipt. IsReadReceiptRequested = true, IsReadReceiptRequestedSpecified = true, // The sender of message requests a delivery receipt. IsDeliveryReceiptRequested = true, IsDeliveryReceiptRequestedSpecified = true, // Response to the message is requested. IsResponseRequested = true, IsResponseRequestedSpecified = true, // Specify the address to which replies should be sent. ReplyTo = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient2 } }, // Specify the Usenet header that is used to correlate replies with their original message. References = this.MsgReference, IsRead = true, IsReadSpecified = true, } } }, }; #endregion 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); #endregion #region Verify the requirements about CreateItem operation // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R111"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R111 Site.CaptureRequirementIfIsNotNull( createItemResponse, 111, @"[In CreateItem] The protocol client sends a CreateItemSoapIn request WSDL message, and the protocol server responds with a CreateItemSoapOut response WSDL message."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R112"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R112 Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, this.infoItems[0].ResponseClass, 112, @"[In CreateItem]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"". "); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R113"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R113 Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.NoError, this.infoItems[0].ResponseCode, 113, @"[In CreateItem] [A successful CreateItem operation request returns a CreateItemResponse element] The ResponseCode element, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the CreateItemResponseMessage element is set to ""NoError"". "); #endregion #region Get the created message via itemIdType in above steps #region The getItemResponseOfFirstMessage is used to store the getItemResponseOfFirstMessage gotten from server when the BaseShape element is set to IdOnly. GetItemType getItemRequest = DefineGeneralGetItemRequestMessage(this.firstItemOfFirstInfoItem.ItemId, DefaultShapeNamesType.IdOnly); GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), "The response of the GetItem should be valid."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R127"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R127 bool isVerifyR127 = Common.IsIdOnly((XmlElement)this.MSGAdapter.LastRawResponseXml, "t:Message", "t:ItemId"); Site.CaptureRequirementIfIsTrue( isVerifyR127, 127, @"[In GetItem] [The BaseShape child element in ItemShape element] Set this element[BaseShape element] to IdOnly to return only the item ID."); #endregion #region The getItemResponseOfFirstMessage is used to store the getItemResponseOfFirstMessage got from server when the BaseShape element is set to AllProperties. getItemRequest.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties; getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), @"Server should return success for getting the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(getItemResponse); Site.Assert.IsNotNull(this.infoItems, @"The GetItem response should contain one or more items of ItemInfoResponseMessageType."); MessageType messageItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0) as MessageType; Site.Assert.IsNotNull(messageItem, @"The message item returned from server response should not be null."); #region Verify requirements about GetItem operation // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R133"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R133 Site.CaptureRequirementIfIsNotNull( getItemResponse, 133, @"[In GetItem] The protocol client sends a GetItemSoapIn request WSDL message, and the protocol server responds with a GetItemSoapOut response WSDL message."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R134"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R134 Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, this.infoItems[0].ResponseClass, 134, @"[In GetItem] If the GetItem WSDL operation request is successful, the server returns a GetItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.4.2.2, with the ResponseClass attribute, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the GetItemResponseMessage element, as specified in [MS-OXWSCDATA] section 2.2.4.12, set to ""Success"". "); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R135"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R135 Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.NoError, this.infoItems[0].ResponseCode, 135, @"[In GetItem] [A successful GetItem operation request returns a GetItemResponse element] The ResponseCode element, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the GetItemResponseMessage element is set to ""NoError"". "); bool isVerifiedR198 = Common.IsIdOnly((XmlElement)this.MSGAdapter.LastRawResponseXml, "t:Message", "t:ItemId"); this.Site.CaptureRequirementIfIsFalse( isVerifiedR198, 198, @"[In GetItem] [The BaseShape child element in ItemShape element] Set it[BaseShape element] to AllProperties to return all of the properties used by the server to construct a message."); #endregion #region Verify the child elements of the MessageType // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R2916, expected the length of EmailAddress is greater than zero, actual length is {0}", messageItem.ToRecipients[0].EmailAddress.Length); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R2916 // The type of the EmailAddress is verified in adapter capture code, only need to check whether this string has a minimum of one character. this.Site.CaptureRequirementIfIsTrue( messageItem.ToRecipients[0].EmailAddress.Length > 0, 2916, @"[In t:MessageType Complex Type] When the Mailbox element of ToRecipients element include an EmailAddress element of t:NonEmptyStringType, the t:NonEmptyStringType simple type specifies a string that MUST have a minimum of one character."); if (Common.IsRequirementEnabled(1428001, this.Site)) { this.Site.CaptureRequirementIfAreEqual<MailboxTypeType>( MailboxTypeType.Mailbox, messageItem.ToRecipients[0].MailboxType, 2912, @"[In t:MessageType Complex Type]When the Mailbox element of ToRecipients element include an MailboxType element of t:MailboxTypeType, the value ""Mailbox"" of t:MailboxTypeType specifies a mail-enabled directory service object."); } Site.Assert.AreEqual<string>(this.Recipient1.ToLower(), messageItem.ToRecipients[0].EmailAddress.ToLower(), "The EmailAddress of the ToRecipients element in GetItem response should be equal with the settings"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R30"); // Each user has his own EmailAddress, if the above assert is passed, the following requirements can be captured directly. this.Site.CaptureRequirement( 30, @"[In t:MessageType Complex Type] ToRecipients element Specifies a collection of recipients of an email."); Site.Assert.AreEqual<string>(this.Recipient2.ToLower(), messageItem.CcRecipients[0].EmailAddress.ToLower(), "The EmailAddress of the CcRecipients element in GetItem response should be equal with the settings"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R33"); // Each user has his own EmailAddress, if the above assert is passed, the following requirements can be captured directly. this.Site.CaptureRequirement( 33, @"[In t:MessageType Complex Type] CcRecipients element Specifies a collection of recipients that receive a carbon copy (Cc) of an email."); Site.Assert.AreEqual<string>(this.MeetingRoom.ToLower(), messageItem.BccRecipients[0].EmailAddress.ToLower(), "The EmailAddress of the BccRecipients element in GetItem response should be equal with the settings"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R36"); // Each user has his own EmailAddress, if the above assert is passed, the following requirements can be captured directly. this.Site.CaptureRequirement( 36, @"[In t:MessageType Complex Type] BccRecipients element Specifies a collection of recipients that receive a blind carbon copy (Bcc) of an email."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R42"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R42 this.Site.CaptureRequirementIfIsTrue( messageItem.IsReadReceiptRequested, 42, @"[In t:MessageType Complex Type] [IsReadReceiptRequested element] A text value of ""true"" indicates that a read receipt is requested from the recipient of the message."); // If the R42 is verified, then the IsReadReceiptRequested is a boolean and it indicates that a read receipt is requested from the recipient of the message. // So the R39 will be verified. this.Site.CaptureRequirement( 39, @"[In t:MessageType Complex Type] IsReadReceiptRequested element Specifies a Boolean value that indicates whether the sender of a message requests a read receipt."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R46"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R46 this.Site.CaptureRequirementIfIsTrue( messageItem.IsDeliveryReceiptRequested, 46, @"[In t:MessageType Complex Type] [IsDeliveryReceiptRequested element] A text value of ""true"" indicates that a delivery receipt has been requested from the recipient of the message."); // If the R46 is verified, then the IsDeliveryReceiptRequested is a boolean and it indicates that a delivery receipt has been requested from the recipient of the message. // So the R43 will be verified. this.Site.CaptureRequirement( 43, @"[In t:MessageType Complex Type] IsDeliveryReceiptRequested element Specifies a Boolean value that indicates whether the sender of the message has requested a delivery receipt."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R61"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R61 this.Site.CaptureRequirementIfIsTrue( messageItem.IsRead, 61, @"[In t:MessageType Complex Type] [IsRead element]The text value of ""true"" indicates that the message has been read."); // If R61 is verified, then the IsRead is boolean and it indicates that the message has been read. // So the R59 will be verified. this.Site.CaptureRequirement( 59, @"[In t:MessageType Complex Type] IsRead element Specifies a Boolean value that indicates whether the message has been read."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R65"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R65 this.Site.CaptureRequirementIfIsTrue( messageItem.IsResponseRequested, 65, @"[In t:MessageType Complex Type] [IsResponseRequested element] A text value of ""true"" indicates that a response has been requested."); // If R65 is verified, then the IsResponseRequested is boolean and it indicates that a response has been requested. // So R62 will be verified. this.Site.CaptureRequirement( 62, @"[In t:MessageType Complex Type] IsResponseRequested element Specifies a Boolean value that indicates whether a response to an email has been requested."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R66"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R66 this.Site.CaptureRequirementIfAreEqual<string>( this.MsgReference, messageItem.References, 66, @"[In t:MessageType Complex Type] References element Specifies the Usenet header that is used to correlate replies with their original message."); Site.Assert.AreEqual<string>(this.Recipient2.ToLower(), messageItem.ReplyTo[0].EmailAddress.ToLower(), "The EmailAddress of the From element in GetItem response should be equal to the settings"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R69"); // Each user has his own EmailAddress, if the above assert is passed, the following requirements can be captured directly. this.Site.CaptureRequirement( 69, @"[In t:MessageType Complex Type] ReplyTo element Specifies a collection of addresses to send replies to. "); #endregion #region Verify the requirements about the read/write element of MessageType // The messageRequest is used to save the message in request to create. MessageType messageRequest = createItemRequest.Items.Items[0] as MessageType; Site.Assert.IsNotNull(messageRequest, @"The CreateItem request should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R32"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R32 // This requirement can be verified since the createItem response message succeeded which indicates message was created successfully // and the ToRecipients value from getItem response is equal to the setting ToRecipients element value in createItem request. Site.CaptureRequirementIfAreEqual<string>( messageRequest.ToRecipients[0].EmailAddress.ToLower(), messageItem.ToRecipients[0].EmailAddress.ToLower(), 32, @"[In t:MessageType Complex Type] [ToRecipients element] This is a read/write element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R35"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R35 // This requirement can be verified since the createItem response message succeeded which indicates message was created successfully // and the CcRecipients value from getItem response is equal to the setting CcRecipients element value in createItem request. Site.CaptureRequirementIfAreEqual<string>( messageRequest.CcRecipients[0].EmailAddress.ToLower(), messageItem.CcRecipients[0].EmailAddress.ToLower(), 35, @"[In t:MessageType Complex Type] [CcRecipients element] This is a read/write element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R38"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R38 // This requirement can be verified since the createItem response message succeeded which indicates message was created successfully // and the BccRecipients value from getItem response is equal to the setting BccRecipients element value in createItem request. Site.CaptureRequirementIfAreEqual<string>( messageRequest.BccRecipients[0].EmailAddress.ToLower(), messageItem.BccRecipients[0].EmailAddress.ToLower(), 38, @"[In t:MessageType Complex Type] [BccRecipients element] This is a read/write element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R41"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R41 // This requirement can be verified since the createItem response message succeeded which indicates message was created successfully // and the IsReadReceiptRequested value from getItem response is equal to the setting IsReadReceiptRequested element value in createItem request. Site.CaptureRequirementIfAreEqual<bool>( messageRequest.IsReadReceiptRequested, messageItem.IsReadReceiptRequested, 41, @"[In t:MessageType Complex Type] [IsReadReceiptRequested element] This is a read/write element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R45"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R45 // This requirement can be verified since the createItem response message succeeded which indicates message was created successfully // and the IsDeliveryReceiptRequested value from getItem response is equal to the setting IsDeliveryReceiptRequested element value in createItem request. Site.CaptureRequirementIfAreEqual<bool>( messageRequest.IsDeliveryReceiptRequested, messageItem.IsDeliveryReceiptRequested, 45, @"[In t:MessageType Complex Type] [IsDeliveryReceiptRequested element] This is a read/write element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R64"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R64 // This requirement can be verified since the createItem response message succeeded which indicates message was created successfully // and the IsResponseRequested value from getItem response is equal to the setting IsResponseRequested element value in createItem request. Site.CaptureRequirementIfAreEqual<bool>( messageRequest.IsResponseRequested, messageItem.IsResponseRequested, 64, @"[In t:MessageType Complex Type] [IsResponseRequested element] This is a read/write element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R68"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R68 // This requirement can be verified since the createItem response message succeeded which indicates message was created successfully // and the References value from getItem response is equal to the setting References element value in createItem request. Site.CaptureRequirementIfAreEqual<string>( messageRequest.References, messageItem.References, 68, @"[In t:MessageType Complex Type] [References element] This is a read/write element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R71"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R71 // This requirement can be verified since the createItem response message succeeded which indicates message was created successfully // and the ReplyTo value from getItem response is equal to the setting ReplyTo element value in createItem request. Site.CaptureRequirementIfAreEqual<string>( messageRequest.ReplyTo[0].EmailAddress.ToLower(), messageItem.ReplyTo[0].EmailAddress.ToLower(), 71, @"[In t:MessageType Complex Type] [ReplyTo element] This is a read/write element."); this.Site.CaptureRequirementIfAreEqual<bool>( messageRequest.IsRead, messageItem.IsRead, 60, @"[In t:MessageType Complex Type] [IsRead element] This is a read/write element."); #endregion #endregion #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."); GetItemType getdeletedItemRequest = DefineGeneralGetItemRequestMessage(this.firstItemOfFirstInfoItem.ItemId, DefaultShapeNamesType.IdOnly); GetItemResponseType getdeletedItemResponse = this.MSGAdapter.GetItem(getdeletedItemRequest); // verify whether the creating message deleted if (getdeletedItemResponse != null && getdeletedItemResponse.ResponseMessages != null && getdeletedItemResponse.ResponseMessages.Items != null) { if (getdeletedItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Success) { Site.Assert.Fail("Server should not return success for get the email messages information, because the created message have been deleted."); } } #region Verify requirements about DeleteItem operation // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R152"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R152 Site.CaptureRequirementIfIsNotNull( deleteItemResponse, 152, @"[In DeleteItem] The protocol client sends a DeleteItemSoapIn request WSDL message, and the protocol server responds with a DeleteItemSoapOut response WSDL message."); Site.Assert.IsNotNull(deleteItemResponse.ResponseMessages.Items[0], @"The first item of the array of InfoItems in server response should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R153"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R153 Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, deleteItemResponse.ResponseMessages.Items[0].ResponseClass, 153, @"[In DeleteItem] If the DeleteItem WSDL operation request is successful, the server returns a DeleteItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.3.2.2, with the ResponseClass attribute, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the DeleteItemResponseMessage element, as specified in [MS-OXWSCDATA] section 2.2.4.12, set to ""Success"". "); Site.Assert.IsNotNull(deleteItemResponse.ResponseMessages.Items[0].ResponseCode, @"The ResponseCode property of the first item of the array of InfoItems should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R154"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R154 Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.NoError, deleteItemResponse.ResponseMessages.Items[0].ResponseCode, 154, @"[In DeleteItem] [A successful DeleteItem operation request returns a DeleteItemResponse element] The ResponseCode element, as specified by [MS-OXWSCDATA] section 2.2.4.67, of the DeleteItemResponseMessage element is set to ""NoError"". "); #endregion #endregion }
/// <summary> /// Verify the array of items uploaded to a mailbox /// </summary> /// <param name="getItems">The items information.</param> protected void VerifyItemsUploadedToMailbox(ItemType[] getItems) { bool isSameItemSubject = false; for (int i = 0; i < getItems.Length; i++) { // Log the expected subject and actual subject Site.Log.Add( LogEntryKind.Debug, "The new uploaded item with subject '{0}' should have the same subject '{1}' with the original one.", getItems[i].Subject, this.CreatedItemSubject[i]); if (this.CreatedItemSubject[i] == getItems[i].Subject) { isSameItemSubject = true; } else { isSameItemSubject = false; break; } } Site.Assert.IsTrue(isSameItemSubject, "The uploaded items' subject should be same to the created items' subject."); // Add debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSBTRF_R195"); // Verify requirement MS-OXWSBTRF_R195 // After verify the length of items in UploadItems response is equal to this.ItemCount, and uploaded Items' subject are the same as created items' subject then requirement MS-OXWSBTRF_R195 can be captured. Site.CaptureRequirement( 195, @"[In t:NonEmptyArrayOfUploadItemsType Complex Type][Item] specifies the array of items to upload in to a mailbox."); // Add debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSBTRF_R207"); // Verify requirement MS-OXWSBTRF_R207 // After verify the length of items in UploadItems response is equal to this.ItemCount, and uploaded Items' subject are the same as created items' subject then requirement MS-OXWSBTRF_R207 can be captured. Site.CaptureRequirement( 207, @"[In m:UploadItemsType Complex Type][The element Items] specifies the collection of items to upload into a mailbox."); }
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_S01_TC04_UpdateItemSuccessfully() { #region Step 1: Create the item. ItemType item = new ItemType(); ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item); #endregion #region Step 2: Update the item, using AppendToItemField element. UpdateItemResponseType updateItemResponse; ItemChangeType[] itemChanges; itemChanges = new ItemChangeType[1]; itemChanges[0] = new ItemChangeType(); // Update the created item. itemChanges[0].Item = createdItemIds[0]; itemChanges[0].Updates = new ItemChangeDescriptionType[1]; AppendToItemFieldType append = new AppendToItemFieldType(); append.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemBody }; append.Item1 = new ItemType() { Body = new BodyType() { BodyType1 = BodyTypeType.Text, Value = TestSuiteHelper.BodyForBaseItem } }; itemChanges[0].Updates[0] = append; // Call UpdateItem to update the body of the created item, by using ItemId in CreateItem response. updateItemResponse = this.CallUpdateItemOperation( DistinguishedFolderIdNameType.drafts, true, itemChanges); // Check the operation response. Common.CheckOperationSuccess(updateItemResponse, 1, this.Site); ItemIdType[] updatedItemIds = createdItemIds; // One updated item should be returned. Site.Assert.AreEqual<int>( 1, updatedItemIds.GetLength(0), "One updated item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, updatedItemIds.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_R508"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R508 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( updateItemResponse, 508, @"[In m:UpdateItemResponseType Complex Type] The UpdateItemResponseType complex type extends the BaseResponseMessageType complex type ([MS-OXWSCDATA] section 2.2.4.16)."); UpdateItemResponseMessageType updateItemResponseMessage = updateItemResponse.ResponseMessages.Items[0] as UpdateItemResponseMessageType; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R158"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R158 this.Site.CaptureRequirementIfIsTrue( updateItemResponseMessage.Items.Items[0].ItemId.Id == createdItemIds[0].Id && updateItemResponseMessage.Items.Items[0].ItemId.ChangeKey != createdItemIds[0].ChangeKey, 158, @"[In t:ItemIdType Complex Type] [The attribute ""ChangeKey""] Specifies a change key."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R58"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R58 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( updateItemResponseMessage, 58, @"[In m:UpdateItemResponseMessageType Complex Type] The UpdateItemResponseMessageType complex type extends the ItemInfoResponseMessageType complex type ([MS-OXWSCDATA] section 2.2.4.37)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1586"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1586 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( updateItemResponseMessage, "MS-OXWSCDATA", 1586, @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""UpdateItemResponseMessage"" is ""m:UpdateItemResponseMessageType"" type ([MS-OXWSCORE] section 2.2.4.6)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1040"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1040 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( updateItemResponseMessage, "MS-OXWSCDATA", 1040, @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""UpdateItemResponseMessage"" with type ""m:UpdateItemResponseMessageType"" specifies the response message for the UpdateItem operation ([MS-OXWSCORE] section 3.1.4.9)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1305"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1305 // The schema is validated and the conflict result is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( updateItemResponseMessage.ConflictResults, 1305, @"[In m:UpdateItemResponseMessageType Complex Type] The type of ConflictResults is t:ConflictResultsType (section 2.2.4.7)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1306"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1306 // The schema is validated, so this requirement can be captured. this.Site.CaptureRequirement( 1306, @"[In t:ConflictResultsType Complex Type] The type of Count is xs:int [XMLSCHEMA2]."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R65"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R65 // The schema is validated, so this requirement can be captured. this.Site.CaptureRequirement( 65, @"[In t:ConflictResultsType Complex Type] [The element ""Count""] Specifies an integer value that indicates the number of conflicts in an UpdateItem operation response."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R61"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R61 // The schema is validated and the conflict result is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( updateItemResponseMessage.ConflictResults, 61, @"[In m:UpdateItemResponseMessageType Complex Type] [The element ""ConflictResults""] Specifies the number of conflicts in the result of a single call."); #endregion #region Step 3: Get the item to check the updates. // Call GetItem to get the updated item, by using updatedItemIds in UpdateItem response. GetItemResponseType getItemResponse = this.CallGetItemOperation(updatedItemIds); // 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)); ItemInfoResponseMessageType getItemResponseMessage = getItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; Site.Assert.AreEqual<BodyTypeType>( append.Item1.Body.BodyType1, getItemResponseMessage.Items.Items[0].Body.BodyType1, string.Format( "The value of BodyType1 should be {0}, actual {1}.", append.Item1.Body.BodyType1, getItemResponseMessage.Items.Items[0].Body.BodyType1)); Site.Assert.AreEqual<string>( append.Item1.Body.Value, getItemResponseMessage.Items.Items[0].Body.Value, string.Format( "The value of Body should be {0}, actual {1}.", append.Item1.Body.Value, getItemResponseMessage.Items.Items[0].Body.Value)); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R555"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R555 // The value of BodyType1 from response is equal to the value of BodyType1 from the request, // and the value of Body from response is equal to the value of Body from request, // so this requirement can be captured. this.Site.CaptureRequirement( 555, @"[In t:NonEmptyArrayOfItemChangeDescriptionsType Complex Type] [The element ""AppendToItemField""] Specifies data to append to a single property of an item during an UpdateItem operation."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R561"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R561 // The value of BodyType1 from response is equal to the value of BodyType1 from the request, // and the value of Body from response is equal to the value of Body from request, // so this requirement can be captured. this.Site.CaptureRequirement( 561, @"[In t:NonEmptyArrayOfItemChangesType Complex Type] [The element ""ItemChange""] Specifies an item identifier and the updates to apply to the item."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R514"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R514 // Because the value of SavedItemFolderId cannot be compared with the parent folder id from response. // So if the updated item can be gotten successfully, this requirement can be captured. this.Site.CaptureRequirement( 514, @"[In m:UpdateItemType Complex Type] [The element ""SavedItemFolderId""] Specifies the target folder for saved items."); #endregion #region Step 4: Update the item, using SetItemField element. itemChanges = new ItemChangeType[1]; itemChanges[0] = new ItemChangeType(); itemChanges[0].Item = getItemIds[0]; itemChanges[0].Updates = new ItemChangeDescriptionType[1]; SetItemFieldType setItem = new SetItemFieldType(); setItem.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemSubject }; setItem.Item1 = new ItemType() { Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForUpdateItem) }; itemChanges[0].Updates[0] = setItem; // Call UpdateItem to update the subject of the created item, by using ItemId in CreateItem response. updateItemResponse = this.CallUpdateItemOperation( DistinguishedFolderIdNameType.drafts, true, itemChanges); // Check the operation response. Common.CheckOperationSuccess(updateItemResponse, 1, this.Site); updatedItemIds = Common.GetItemIdsFromInfoResponse(updateItemResponse); // One updated item should be returned. Site.Assert.AreEqual<int>( 1, updatedItemIds.GetLength(0), "One updated item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, updatedItemIds.GetLength(0)); #endregion #region Step 5: Get the item to check the updates. // Call GetItem to get the updated item in the Inbox folder, by using updatedItemIds in UpdateItem response. getItemResponse = this.CallGetItemOperation(updatedItemIds); // 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)); getItemResponseMessage = getItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R556"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R556 this.Site.CaptureRequirementIfAreEqual<string>( setItem.Item1.Subject, getItemResponseMessage.Items.Items[0].Subject, 556, @"[In t:NonEmptyArrayOfItemChangeDescriptionsType Complex Type] [The element ""SetItemField""] Specifies an update to a single property of an item in an UpdateItem operation."); #endregion #region Step 6: Update the item, using DeleteItemField element. itemChanges = new ItemChangeType[1]; itemChanges[0] = new ItemChangeType(); itemChanges[0].Item = getItemIds[0]; itemChanges[0].Updates = new ItemChangeDescriptionType[1]; DeleteItemFieldType delField = new DeleteItemFieldType(); delField.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemBody }; itemChanges[0].Updates[0] = delField; // Call UpdateItem to delete the body value of the created item, by using ItemId in CreateItem response. updateItemResponse = this.CallUpdateItemOperation( DistinguishedFolderIdNameType.drafts, true, itemChanges); // Check the operation response. Common.CheckOperationSuccess(updateItemResponse, 1, this.Site); updatedItemIds = Common.GetItemIdsFromInfoResponse(updateItemResponse); // One updated item should be returned. Site.Assert.AreEqual<int>( 1, updatedItemIds.GetLength(0), "One updated item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, updatedItemIds.GetLength(0)); #endregion #region Step 7: Get the item to check the updates // Call GetItem to get the updated item in the Inbox folder, by using updatedItemIds in UpdateItem response. getItemResponse = this.CallGetItemOperation(updatedItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); getItemResponseMessage = getItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R557"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R557 // The value of Body is null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNull( getItemResponseMessage.Items.Items[0].Body.Value, 557, @"[In t:NonEmptyArrayOfItemChangeDescriptionsType Complex Type] [The element ""DeleteItemField"" with type ""t:DeleteItemFieldType""] Specifies an operation to delete a given property from an item during an UpdateItem operation."); #endregion }
public void MSOXWSCORE_S01_TC05_MarkAllItemsAsReadSuccessfully() { Site.Assume.IsTrue(Common.IsRequirementEnabled(1290, this.Site), "Exchange 2007 and Exchange 2010 do not support the MarkAllItemsAsRead operation."); #region Step 1: Create two items. ItemType[] createdItems = new ItemType[] { new ItemType(), new ItemType() }; createdItems[0].Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForCreateItem, 1); createdItems[1].Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForCreateItem, 2); CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.drafts, createdItems); // Check the operation response. Common.CheckOperationSuccess(createItemResponse, 2, this.Site); ItemIdType[] createdItemIds = Common.GetItemIdsFromInfoResponse(createItemResponse); // Two created items should be returned. Site.Assert.AreEqual<int>( 2, createdItemIds.GetLength(0), "Two created item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 2, createdItemIds.GetLength(0)); #endregion #region Step 2: Get two items. // Call the GetItem operation. GetItemResponseType getItemResponse = this.CallGetItemOperation(createdItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 2, this.Site); ItemIdType[] getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); // Two items should be returned. Site.Assert.AreEqual<int>( 2, getItemIds.GetLength(0), "Two item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 2, getItemIds.GetLength(0)); #endregion #region Step 3: Mark all items as unread, and suppress the receive receipts. BaseFolderIdType[] folderIds = new BaseFolderIdType[1]; DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType(); distinguishedFolderId.Id = DistinguishedFolderIdNameType.drafts; folderIds[0] = distinguishedFolderId; // Mark all items in drafts folder as unread, and suppress the receive receipts. MarkAllItemsAsReadResponseType markAllItemsAsReadResponse = this.CallMarkAllItemsAsReadOperation(false, true, folderIds); // Check the operation response. Common.CheckOperationSuccess(markAllItemsAsReadResponse, 1, this.Site); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); if (Common.IsRequirementEnabled(1054011, this.Site)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1054011"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1054011 // The MarkAllItemsAsReadResponseMessage is not null and the schema is validated, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( markAllItemsAsReadResponse.ResponseMessages.Items[0], "MS-OXWSCDATA", 1054011, @"[In Appendix C: Product Behavior] Implementation does use the element ""MarkAllItemsAsReadResponseMessage"" with type ""m:ResponseMessageType"", which specifies the response message for the MarkAllItemsAsRead operation.(Exchange 2013 and above follow this behavior.)"); } // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1212"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1212 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( markAllItemsAsReadResponse, 1212, @"[In m:MarkAllItemsAsReadResponseType Complex Type] The MarkAllItemsAsReadResponseType complex type extends the BaseResponseMessageType complex type ([MS-OXWSCDATA] section 2.2.4.16)."); #endregion #region Step 4: Get two items and check the updates. // Call the GetItem operation. getItemResponse = this.CallGetItemOperation(createdItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 2, this.Site); getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); // Two items should be returned. Site.Assert.AreEqual<int>( 2, getItemIds.GetLength(0), "Two item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 2, getItemIds.GetLength(0)); #endregion #region Step 5: Mark all items as read, and suppress the receive receipts. // Mark all items in drafts folder as read, and suppress the receive receipts. markAllItemsAsReadResponse = this.CallMarkAllItemsAsReadOperation(true, true, folderIds); // Check the operation response. Common.CheckOperationSuccess(markAllItemsAsReadResponse, 1, this.Site); #endregion #region Step 6:Get two items and check the updates // Call the GetItem operation. getItemResponse = this.CallGetItemOperation(createdItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 2, this.Site); getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); // Two items should be returned. Site.Assert.AreEqual<int>( 2, getItemIds.GetLength(0), "Two item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 2, getItemIds.GetLength(0)); #endregion #region Step 7: Mark all items as unread, and don't suppress the receive receipts. // Mark all items in drafts folder as unread, and don't suppress the receive receipts markAllItemsAsReadResponse = this.CallMarkAllItemsAsReadOperation(false, false, folderIds); // Check the operation response. Common.CheckOperationSuccess(markAllItemsAsReadResponse, 1, this.Site); #endregion #region Step 8: Get two items and check the updates. // Call the GetItem operation. getItemResponse = this.CallGetItemOperation(createdItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 2, this.Site); getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); // Two items should be returned. Site.Assert.AreEqual<int>( 2, getItemIds.GetLength(0), "Two item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 2, getItemIds.GetLength(0)); #endregion #region Step 9: Mark all items as read, and don't suppress the receive receipts. // Mark all items in drafts folder as read, and don't suppress the receive receipts. markAllItemsAsReadResponse = this.CallMarkAllItemsAsReadOperation(true, false, folderIds); // Check the operation response. Common.CheckOperationSuccess(markAllItemsAsReadResponse, 1, this.Site); #endregion #region Step 10: Get two items and check the updates. // Call the GetItem operation. getItemResponse = this.CallGetItemOperation(createdItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 2, this.Site); getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); // Two items should be returned. Site.Assert.AreEqual<int>( 2, getItemIds.GetLength(0), "Two item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 2, getItemIds.GetLength(0)); #endregion }
public void MSOXWSCORE_S01_TC44_GetItemWithFilterHtmlContent() { Site.Assume.IsTrue(Common.IsRequirementEnabled(2119413, this.Site), "Exchange 2007 do not support the FilterHtmlContent element."); ItemType item = new ItemType(); this.TestSteps_VerifyGetItemWithItemResponseShapeType_FilterHtmlContentBoolean(item); }
public void MSOXWSCORE_S01_TC03_MoveItemSuccessfully() { #region Step 1: Create the item. ItemType item = new ItemType(); ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item); #endregion #region Step 2: Move the item. MoveItemType moveItemRequest = new MoveItemType(); MoveItemResponseType moveItemResponse = new MoveItemResponseType(); // Configure ItemIds. moveItemRequest.ItemIds = createdItemIds; // Clear ExistItemIds for MoveItem. this.InitializeCollection(); // Configure moving item to inbox folder. DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType(); distinguishedFolderId.Id = DistinguishedFolderIdNameType.inbox; moveItemRequest.ToFolderId = new TargetFolderIdType(); moveItemRequest.ToFolderId.Item = distinguishedFolderId; moveItemResponse = this.COREAdapter.MoveItem(moveItemRequest); // Check the operation response. Common.CheckOperationSuccess(moveItemResponse, 1, this.Site); ItemIdType[] movedItemIds = Common.GetItemIdsFromInfoResponse(moveItemResponse); // One moved item should be returned. Site.Assert.AreEqual<int>( 1, movedItemIds.GetLength(0), "One moved item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, movedItemIds.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_R419"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R419 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( moveItemResponse, 419, @"[In m:MoveItemResponseType Complex Type] The MoveItemResponseType 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_R46"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R46 // If the schema is validated, this requirement can be captured. this.Site.CaptureRequirement( 46, @"[In m:BaseMoveCopyItemType Complex Type] [The element ""ItemIds""] Specifies an array of elements of type BaseItemIdType that specifies a set of items to be moved."); ItemInfoResponseMessageType moveItemResponseMessage = moveItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1601"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1601 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( moveItemResponseMessage, "MS-OXWSCDATA", 1601, @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""MoveItemResponseMessage"" is ""m:ItemInfoResponseMessageType"" type (section 2.2.4.37)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1056"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1056 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( moveItemResponseMessage, "MS-OXWSCDATA", 1056, @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""MoveItemResponseMessage"" with type ""m:ItemInfoResponseMessageType(section 2.2.4.37)"" specifies the response message for the MoveItem operation ([MS-OXWSCORE] section 3.1.4.7)."); #endregion #region Step 3: Get the created item failed. // Call the GetItem operation. GetItemResponseType getItemResponse = this.CallGetItemOperation(createdItemIds); Site.Assert.AreEqual<int>( 1, getItemResponse.ResponseMessages.Items.GetLength(0), "Expected Item Count: {0}, Actual Item Count: {1}", 1, getItemResponse.ResponseMessages.Items.GetLength(0)); Site.Assert.AreEqual<ResponseClassType>( ResponseClassType.Error, getItemResponse.ResponseMessages.Items[0].ResponseClass, string.Format( "Get item operation should be failed with error! Actual response code: {0}", getItemResponse.ResponseMessages.Items[0].ResponseCode)); #endregion #region Step 4: Get the moved item. // Call the GetItem operation. getItemResponse = this.CallGetItemOperation(movedItemIds); // 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)); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R45"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R45 // If the moved item was got successfully, R45 can be captured. this.Site.CaptureRequirement( 45, @"[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 moved."); #endregion }
public void MSOXWSCORE_S01_TC43_RightsManagementLicenseDataIsReadOnly() { Site.Assume.IsTrue(Common.IsRequirementEnabled(1355, this.Site), "Exchange 2007 and Exchange 2010 do not support the RightsManagementLicenseData element."); #region Create an item with setting RightsManagementLicenseData ItemType[] createdItems = new ItemType[] { new ItemType() }; createdItems[0].Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForCreateItem); createdItems[0].RightsManagementLicenseData = new RightsManagementLicenseDataType(); createdItems[0].RightsManagementLicenseData.EditAllowedSpecified = true; createdItems[0].RightsManagementLicenseData.EditAllowed = true; CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.drafts, createdItems); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2052"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2052 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorInvalidPropertySet, createItemResponse.ResponseMessages.Items[0].ResponseCode, 2052, @"[In t:ItemType Complex Type] This element [RightsManagementLicenseData] is read-only."); #endregion #region Update an item with setting RightsManagementLicenseData ItemType item = new ItemType(); ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item); UpdateItemResponseType updateItemResponse; ItemChangeType[] itemChanges; itemChanges = new ItemChangeType[1]; itemChanges[0] = new ItemChangeType(); // Update the created item. itemChanges[0].Item = createdItemIds[0]; itemChanges[0].Updates = new ItemChangeDescriptionType[1]; SetItemFieldType setItem = new SetItemFieldType(); setItem.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemRightsManagementLicenseData }; setItem.Item1 = new ItemType() { RightsManagementLicenseData = new RightsManagementLicenseDataType { EditAllowed = true, EditAllowedSpecified = true } }; itemChanges[0].Updates[0] = setItem; updateItemResponse = this.CallUpdateItemOperation( DistinguishedFolderIdNameType.drafts, true, itemChanges); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2353"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2353 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorInvalidPropertySet, updateItemResponse.ResponseMessages.Items[0].ResponseCode, 2353, @"[In t:ItemType Complex Type] but if [RightsManagementLicenseData] specified in a CreateItem or UpdateItem request, an ErrorInvalidPropertySet ([MS-OXWSCDATA] section 2.2.5.24) will be returned."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1355"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1355 // Server handles the element RightsManagementLicenseData and returns ErrorInvalidPropertySet, this requirement can be captured directly. this.Site.CaptureRequirement( 1355, @"[In Appendix C: Product Behavior] Implementation does support element ""RightsManagementLicenseData"" with type ""t:RightsManagementLicenseDataType (section 2.2.4.37)"" which specifies rights management license data. (Exchange 2013 and above follow this behavior.)"); #endregion }
public void MSOXWSCORE_S01_TC42_IconIndexIsReadOnly() { Site.Assume.IsTrue(Common.IsRequirementEnabled(1917, this.Site), "Exchange 2007 and Exchange 2010 do not support the IconIndex element."); #region Create an item with setting IconIndex ItemType[] createdItems = new ItemType[] { new ItemType() }; createdItems[0].Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForCreateItem); createdItems[0].IconIndexSpecified = true; createdItems[0].IconIndex = IconIndexType.TaskRecur; CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.drafts, createdItems); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2062"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2062 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorInvalidPropertySet, createItemResponse.ResponseMessages.Items[0].ResponseCode, 2062, @"[In t:ItemType Complex Type] This element [IconIndex] is read-only."); #endregion #region Update an item with setting IconIndex ItemType item = new ItemType(); ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item); UpdateItemResponseType updateItemResponse; ItemChangeType[] itemChanges; itemChanges = new ItemChangeType[1]; itemChanges[0] = new ItemChangeType(); // Update the created item. itemChanges[0].Item = createdItemIds[0]; itemChanges[0].Updates = new ItemChangeDescriptionType[1]; SetItemFieldType setItem = new SetItemFieldType(); setItem.Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemIconIndex }; setItem.Item1 = new ItemType() { IconIndex = IconIndexType.TaskRecur, IconIndexSpecified = true }; itemChanges[0].Updates[0] = setItem; updateItemResponse = this.CallUpdateItemOperation( DistinguishedFolderIdNameType.drafts, true, itemChanges); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2358"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2358 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorInvalidPropertySet, updateItemResponse.ResponseMessages.Items[0].ResponseCode, 2358, @"[In t:ItemType Complex Type] but if [IconIndex] specified in a CreateItem or UpdateItem request, an ErrorInvalidPropertySet ([MS-OXWSCDATA] section 2.2.5.24) will be returned."); #endregion }
public void MSOXWSCORE_S01_TC01_CreateGetDeleteItemSuccessfully() { #region Step 1: Create the item. ItemType[] createdItems = new ItemType[] { new ItemType() }; createdItems[0].Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForCreateItem); // Add Complete FlagType to verify R1045 if (Common.IsRequirementEnabled(1271, this.Site)) { createdItems[0].Flag = new FlagType(); createdItems[0].Flag.FlagStatus = FlagStatusType.Complete; createdItems[0].Flag.CompleteDateSpecified = true; createdItems[0].Flag.CompleteDate = DateTime.UtcNow; } CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.drafts, createdItems); // Check the operation response. Common.CheckOperationSuccess(createItemResponse, 1, this.Site); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2169"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2169 this.Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, createItemResponse.ResponseMessages.Items[0].ResponseClass, 2169, @"[In tns:CreateItemSoapOut Message] If the request is successful, the CreateItem operation returns a CreateItemResponse element with the ResponseClass attribute of the CreateItemResponseMessage element set to ""Success""."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2170"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2170 this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.NoError, createItemResponse.ResponseMessages.Items[0].ResponseCode, 2170, @"[In tns:CreateItemSoapOut Message] The ResponseCode element of the CreateItemResponseMessage element is set to ""NoError""."); ItemIdType[] createdItemIds = Common.GetItemIdsFromInfoResponse(createItemResponse); // One created item should be returned. Site.Assert.AreEqual<int>( 1, createdItemIds.GetLength(0), "One created item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, createdItemIds.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_R292"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R292 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( createItemResponse, 292, @"[In m:CreateItemResponseType Complex Type] The CreateItemResponseType complex type extends the BaseResponseMessageType complex type ([MS-OXWSCDATA] section 2.2.4.16)."); ItemInfoResponseMessageType createItemResponseMessage = createItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1583"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1583 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( createItemResponseMessage, "MS-OXWSCDATA", 1583, @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""CreateItemResponseMessage"" is ""m:ItemInfoResponseMessageType""(section 2.2.4.37) type."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1037"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1037 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( createItemResponseMessage, "MS-OXWSCDATA", 1037, @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""CreateItemResponseMessage"" with type ""m:ItemInfoResponseMessageType(section 2.2.4.37)"" specifies the response message for the CreateItem operation ([MS-OXWSCORE] section 3.1.4.2)."); if (Common.IsRequirementEnabled(102000000, this.Site)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R102000000"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R102000000 this.Site.CaptureRequirementIfIsInstanceOfType( createItemResponseMessage.Items.Items[0], typeof(MessageType), "MS-OXWSCDATA", 102000000, @"[In Appendix C: Product Behavior] Implementation does return the items of type t:ItemType as a t:MessageType type. (Exchange 2013 and above follow this behavior.)"); } #endregion #region Step 2: Get the item. // 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)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R380"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R380 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( getItemResponse, 380, @"[In m:GetItemResponseType Complex Type] The GetItemResponseType complex type extends the BaseResponseMessageType complex type ([MS-OXWSCDATA] section 2.2.4.16)."); ItemInfoResponseMessageType getItemResponseMessage = getItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1585"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1585 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( getItemResponseMessage, "MS-OXWSCDATA", 1585, @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""GetItemResponseMessage"" is ""m:ItemInfoResponseMessageType""(section 2.2.4.37) type."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1039"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1039 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( getItemResponseMessage, "MS-OXWSCDATA", 1039, @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""GetItemResponseMessage"" with type ""m:ItemInfoResponseMessageType"" specifies the response message for the GetItem operation ([MS-OXWSCORE] section 3.1.4.4)."); // Verify R1045. if (Common.IsRequirementEnabled(1271, this.Site)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1045"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1045 this.Site.CaptureRequirementIfAreEqual<string>( createdItems[0].Flag.CompleteDate.Date.ToString(), getItemResponseMessage.Items.Items[0].Flag.CompleteDate.Date.ToString(), 1045, @"[In t:FlagType Complex Type] CompleteDate: An element of type dateTime that represents the completion date."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2008"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2008 // The FlagStatus element is set to Complete, and StartDate and DueDate elements are not set, // the item is created and gotten successfully, so this requirement can be captured directly. this.Site.CaptureRequirement( 2008, @"[In t:FlagType Complex Type] if the FlagStatus element is set to Complete, the StartDate and DueDate elements MUST not be set in the request;"); } if (Common.IsRequirementEnabled(2281, this.Site)) { this.Site.Assert.IsTrue(getItemResponseMessage.Items.Items[0].HasAttachmentsSpecified, "The HasAttachments element should be present."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1621"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1621 this.Site.CaptureRequirementIfIsFalse( getItemResponseMessage.Items.Items[0].HasAttachments, 1621, @"[In t:ItemType Complex Type] otherwise [HasAttachments is] false, indicates [an item does not have at least one attachment]."); } #endregion // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R299"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R299 // If the Items element is null in request, the CreateItem operation will fail. // The CreateItem operation executed successfully, so this requirement can be verified directly. Site.CaptureRequirement( 299, @"[In m:CreateItemType Complex Type] [The element ""Items""] Specifies the collection of items to be created."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R387"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R387 // If the Items element is null in request, the GetItem operation will fail. // The GetItem operation executed successfully, so this requirement can be verified directly. Site.CaptureRequirement( 387, @"[In m:GetItemType Complex Type] [The element ""ItemIds""] Specifies the collection of items that a GetItem operation is to get."); #region Step 3: Delete the item. DeleteItemResponseType deleteItemResponse = this.CallDeleteItemOperation(); // Check the operation response. Common.CheckOperationSuccess(deleteItemResponse, 1, this.Site); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R335"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R335 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( deleteItemResponse, 335, @"[In m:DeleteItemResponseType Complex Type] The DeleteItemResponseType 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-OXWSCDATA_R1584"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1584 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( deleteItemResponse.ResponseMessages.Items[0], "MS-OXWSCDATA", 1584, @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""DeleteItemResponseMessage"" is ""m:ResponseMessageType""(section 2.2.4.57) type."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1038"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1038 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( deleteItemResponse.ResponseMessages.Items[0], "MS-OXWSCDATA", 1038, @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""DeleteItemResponseMessage"" with type ""m:ResponseMessageType(section 2.2.4.57)"" specifies the response message for the DeleteItem operation ([MS-OXWSCORE] section 3.1.4.3)."); // Clear ExistItemIds for DeleteItem. this.InitializeCollection(); #endregion #region Step 4:Get the deleted item // Call the GetItem operation. getItemResponse = this.CallGetItemOperation(getItemIds); Site.Assert.AreEqual<int>( 1, getItemResponse.ResponseMessages.Items.GetLength(0), "Expected Item Count: {0}, Actual Item Count: {1}", 1, getItemResponse.ResponseMessages.Items.GetLength(0)); Site.Assert.AreEqual<ResponseClassType>( ResponseClassType.Error, getItemResponse.ResponseMessages.Items[0].ResponseClass, string.Format( "Get deleted item should be failed! Expected response code: {0}, actual response code: {1}", ResponseCodeType.ErrorItemNotFound, getItemResponse.ResponseMessages.Items[0].ResponseCode)); #endregion // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R341"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R341 // The ItemIds are specified in DeleteItem request in step 3, // If the deleted item cannot be gotten in step 4, // This requirement can be verified. Site.CaptureRequirement( 341, @"[In m:DeleteItemType Complex Type] [The element ""ItemIds""] Specifies the collection of items to be deleted."); }
public void MSOXWSMSG_S02_TC01_UpdateMessage() { #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 returned 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 update ToRecipients property of the original message UpdateItemType updateItemRequest = new UpdateItemType { MessageDisposition = MessageDispositionType.SaveOnly, MessageDispositionSpecified = true, ItemChanges = new ItemChangeType[] { new ItemChangeType { Item = itemIdType, Updates = new ItemChangeDescriptionType[] { new SetItemFieldType { Item = new PathToUnindexedFieldType { FieldURI = UnindexedFieldURIType.messageToRecipients }, // Update the ToRecipients of message from Recipient1 to Recipient2. Item1 = new MessageType { ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient2 } } } } } } } }; UpdateItemResponseType updateItemResponse = this.MSGAdapter.UpdateItem(updateItemRequest); Site.Assert.IsTrue(this.VerifyResponse(updateItemResponse), @"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 ItemId of message responseMessageItem got from the UpdateItem response. if (this.firstItemOfFirstInfoItem != null) { 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; } #region Verify the requirements about UpdateItem // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R143"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R143 Site.CaptureRequirementIfIsNotNull( updateItemResponse, 143, @"[In UpdateItem] The protocol client sends an UpdateItemSoapIn request WSDL message, and the protocol server responds with an UpdateItemSoapOut 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_R144"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R144 Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, this.infoItems[0].ResponseClass, 144, @"[In UpdateItem] If the UpdateItem WSDL operation request is successful, the server returns an UpdateItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.9.2.2, with the ResponseClass attribute, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the UpdateItemResponseMessage 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_R145"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R145 Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.NoError, this.infoItems[0].ResponseCode, 145, @"[In UpdateItem] [A successful UpdateItem operation request returns an UpdateItemResponse element] The ResponseCode element, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the UpdateItemResponseMessage element is set to ""NoError"". "); #endregion #endregion #region Get the updated message GetItemType getItemRequest = DefineGeneralGetItemRequestMessage(itemIdType, DefaultShapeNamesType.AllProperties); GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), @"Server should return success for getting the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(getItemResponse); Site.Assert.IsNotNull(this.infoItems, @"The GetItem response should contain one or more items of ItemInfoResponseMessageType."); ItemType updatedItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(updatedItem, @"The updated message should exist"); string expectedValue = Common.GetConfigurationPropertyValue("Recipient2", this.Site); Site.Assert.AreEqual<string>( expectedValue.ToLower(), updatedItem.DisplayTo.ToLower(), string.Format("The expected value of the DisplayTo property is {0}. The actual value is {1}.", expectedValue, updatedItem.DisplayTo)); #endregion #region Clean up Sender's drafts folder bool isClear = this.MSGSUTControlAdapter.CleanupFolders( Common.GetConfigurationPropertyValue("Sender", this.Site), Common.GetConfigurationPropertyValue("SenderPassword", this.Site), this.Domain, this.Subject, "drafts"); Site.Assert.IsTrue(isClear, "Sender's drafts folder should be cleaned up."); #endregion }
public void MSOXWSMSG_S07_TC02_VerifyMessageWithoutOptionalElements() { #region Create the message #region define a CreateItem request without any optional elements of MessageType CreateItemType createItemRequestWithoutAllOptionalElements = new CreateItemType { MessageDisposition = MessageDispositionType.SaveOnly, // MessageDispositionSpecified value needs to be set. MessageDispositionSpecified = true, SavedItemFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.drafts } }, // Define the message which does not contain optional elements. Items = new NonEmptyArrayOfAllItemsType { Items = new MessageType[] { new MessageType { // Specify the subject of message. Subject = this.Subject, } } }, }; #endregion CreateItemResponseType createItemResponseWithoutAllOptionalElement = this.MSGAdapter.CreateItem(createItemRequestWithoutAllOptionalElements); Site.Assert.IsTrue(this.VerifyCreateItemResponse(createItemResponseWithoutAllOptionalElement, MessageDispositionType.SaveOnly), @"Server should return success for creating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponseWithoutAllOptionalElement); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); #endregion #region Get the created message GetItemType getItemRequestWithoutAllOptionalElement = DefineGeneralGetItemRequestMessage(this.firstItemOfFirstInfoItem.ItemId, DefaultShapeNamesType.AllProperties); GetItemResponseType getItemResponseWithoutAllOptionalElement = this.MSGAdapter.GetItem(getItemRequestWithoutAllOptionalElement); Site.Assert.IsTrue(this.VerifyResponse(getItemResponseWithoutAllOptionalElement), @"Server should return success for getting the email messages."); Site.Assert.IsNotNull(this.infoItems[0], "The first item of infoItems object should not be null"); Site.Assert.IsNotNull(this.infoItems[0].ResponseClass, "The ResponseClass property of infoItems[0] object should not be null"); Site.Assert.IsNotNull(this.infoItems[0].Items, "The Items property of the first item should not be null."); #endregion #region Verify the optional elements // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R27"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R27 // This requirement can be verified since it's successful when creating the message without any optional properties specified in MessageType. Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, this.infoItems[0].ResponseClass, 27, @"[In t:MessageType Complex Type] [Sender element]This element is optional."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R34"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R34 // This requirement can be verified since it's successful when creating the message without any optional properties specified in MessageType. Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, this.infoItems[0].ResponseClass, 34, @"[In t:MessageType Complex Type] [CcRecipients element] This element is optional."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R37"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R37 // This requirement can be verified since it's successful when creating the message without any optional properties specified in MessageType. Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, this.infoItems[0].ResponseClass, 37, @"[In t:MessageType Complex Type] [BccRecipients element] This element is optional."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R40"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R40 // This requirement can be verified since it's successful when creating the message without any optional properties specified in MessageType. Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, this.infoItems[0].ResponseClass, 40, @"[In t:MessageType Complex Type] [IsReadReceiptRequested element] This element is optional."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R48"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R48 // This requirement can be verified since it's successful when creating the message without any optional properties specified in MessageType. Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, this.infoItems[0].ResponseClass, 48, @"[In t:MessageType Complex Type] [ConversationIndex element] This element is optional."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R51"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R51 // This requirement can be verified since it's successful when creating the message without any optional properties specified in MessageType. Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, this.infoItems[0].ResponseClass, 51, @"[In t:MessageType Complex Type] [ConversationTopic element] This element is optional."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R54"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R54 // This requirement can be verified since it's successful when creating the message without any optional properties specified in MessageType. Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, this.infoItems[0].ResponseClass, 54, @"[In t:MessageType Complex Type] [From element] This element is optional."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R57"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R57 // This requirement can be verified since it's successful when creating the message without any optional properties specified in MessageType. Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, this.infoItems[0].ResponseClass, 57, @"[In t:MessageType Complex Type] [InternetMessageId element] This element is optional."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R63"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R63 // This requirement can be verified since it's successful when creating the message without any optional properties specified in MessageType. Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, this.infoItems[0].ResponseClass, 63, @"[In t:MessageType Complex Type] [IsResponseRequested element] This element is optional."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R67"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R67 // This requirement can be verified since it's successful when creating the message without any optional properties specified in MessageType. Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, this.infoItems[0].ResponseClass, 67, @"[In t:MessageType Complex Type] [References element] This element is optional."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R70"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R70 // This requirement can be verified since it's successful when creating the message without any optional properties specified in MessageType. Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, this.infoItems[0].ResponseClass, 70, @"[In t:MessageType Complex Type] [ReplyTo element] This element is optional."); #endregion #region Clean up Sender's drafts folder bool isClear = this.MSGSUTControlAdapter.CleanupFolders( Common.GetConfigurationPropertyValue("Sender", this.Site), Common.GetConfigurationPropertyValue("SenderPassword", this.Site), this.Domain, this.Subject, "drafts"); Site.Assert.IsTrue(isClear, "Sender's drafts folder should be cleaned up."); #endregion }
public void MSOXWSMSG_S04_TC01_MoveMessage() { #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 Move message MoveItemType moveItemRequest = new MoveItemType { ItemIds = new ItemIdType[] { itemIdType }, // Set target folder to junk email folder. ToFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.junkemail } } }; MoveItemResponseType moveItemResponse = this.MSGAdapter.MoveItem(moveItemRequest); Site.Assert.IsTrue(this.VerifyResponse(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 message responseMessageItem got from the moveItem response. ItemIdType moveItemIdType = new ItemIdType(); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); moveItemIdType.Id = this.firstItemOfFirstInfoItem.ItemId.Id; moveItemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; // Verify whether the message is moved to junkemail folder. string userName = Common.GetConfigurationPropertyValue("Sender", this.Site); string password = Common.GetConfigurationPropertyValue("SenderPassword", this.Site); string domain = Common.GetConfigurationPropertyValue("Domain", this.Site); bool findItemInDrafts = this.IsItemAvailableAfterMoveOrDelete(userName, password, domain, "drafts", this.Subject, "itemSubject"); Site.Assert.IsFalse(findItemInDrafts, "The item should not be found in the drafts folder of Sender."); bool findItemInJunkemail = this.SearchItems(Role.Sender, "junkemail", this.Subject, "itemSubject"); Site.Assert.IsTrue(findItemInJunkemail, "The item should be found in the junkemail folder of Sender."); #region Verify the requirements about MoveItem // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R161"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R161 Site.CaptureRequirementIfIsNotNull( moveItemResponse, 161, @"[In MoveItem] The protocol client sends a MoveItemSoapIn request WSDL message, and the protocol server responds with a MoveItemSoapOut 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_R162"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R162 Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, this.infoItems[0].ResponseClass, 162, @"[In MoveItem] If the MoveItem WSDL operation request is successful, the server returns a MoveItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.7.2.2, with the ResponseClass attribute, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the MoveItemResponseMessage 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_R163"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R163 Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.NoError, this.infoItems[0].ResponseCode, 163, @"[In MoveItem] [A successful MoveItem operation request returns a MoveItemResponse element] The ResponseCode element, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the MoveItemResponseMessage element is set to ""NoError"". "); #endregion #endregion #region Delete the moved message DeleteItemType deleteItemRequest = new DeleteItemType { ItemIds = new ItemIdType[] { moveItemIdType } }; DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest); Site.Assert.IsTrue(this.VerifyResponse(deleteItemResponse), @"Server should return success for deleting the email messages."); #endregion }
public void MSOXWSMSG_S07_TC03_VerifyConversationIndexIsReadOnly() { #region Create a message which include the ConversationIndex element. 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 { Items = new MessageType[] { // Create a MessageType instance with all element. new MessageType { // Specify the sender of the message. Sender = new SingleRecipientType { Item = new EmailAddressType { EmailAddress = this.Sender } }, // Specify the recipient of the message. ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } }, ConversationIndex = new byte[] { }, } } }, }; CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest); Site.Assert.AreEqual<ResponseCodeType>(ResponseCodeType.ErrorInvalidPropertySet, createItemResponse.ResponseMessages.Items[0].ResponseCode, "Since ConversationIndex is read-only, then the The ErrorInvalidPropertySet should be returned by server."); this.Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Error, createItemResponse.ResponseMessages.Items[0].ResponseClass, 113001, @"[In CreateItem] If the CreateItem WSDL operation is not successful, it returns a CreateItemResponse element with the ResponseClass attribute of the CreateItemResponseMessage element set to ""Error"". "); this.Site.CaptureRequirementIfIsTrue( System.Enum.IsDefined(typeof(ResponseCodeType), createItemResponse.ResponseMessages.Items[0].ResponseCode), 113002, @"[In CreateItem] [A unsuccessful CreateItem operation request returns a CreateItemResponse 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 #region Create message createItemRequest = this.GetCreateItemType(MessageDispositionType.SaveOnly, DistinguishedFolderIdNameType.drafts); 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 returned 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 update ConversationIndex property of the original message UpdateItemType updateItemRequest = new UpdateItemType { MessageDisposition = MessageDispositionType.SaveOnly, MessageDispositionSpecified = true, ItemChanges = new ItemChangeType[] { new ItemChangeType { Item = itemIdType, Updates = new ItemChangeDescriptionType[] { new SetItemFieldType { Item = new PathToUnindexedFieldType { FieldURI = UnindexedFieldURIType.messageConversationIndex }, Item1 = new MessageType { ConversationIndex = new byte[] { } } } } } } }; UpdateItemResponseType updateItemResponse = this.MSGAdapter.UpdateItem(updateItemRequest); Site.Assert.AreEqual<ResponseCodeType>(ResponseCodeType.ErrorInvalidPropertySet, updateItemResponse.ResponseMessages.Items[0].ResponseCode, "Since ConversationIndex is read-only, then the The ErrorInvalidPropertySet should be returned by server."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R145001"); this.Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Error, updateItemResponse.ResponseMessages.Items[0].ResponseClass, 145001, @"[In UpdateItem] If the UpdateItem WSDL operation request is not successful, it returns an UpdateItemResponse element with the ResponseClass attribute of the UpdateItemResponseMessage element set to ""Error"". "); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R145002"); this.Site.CaptureRequirementIfIsTrue( System.Enum.IsDefined(typeof(ResponseCodeType), updateItemResponse.ResponseMessages.Items[0].ResponseCode), 145002, @"[In UpdateItem] [A unsuccessful UpdateItem operation request returns an UpdateItemResponse element] The ResponseCode element of the UpdateItemResponseMessage element is set to one of the common errors defined in [MS-OXWSCDATA] section 2.2.5.24."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R49"); // If the above steps are pass, the R49 will be verified. this.Site.CaptureRequirement( 49, @"[In t:MessageType Complex Type] [ConversationIndex element] This element is read-only."); #endregion #region Clean up Sender's drafts folder bool isClear = this.MSGSUTControlAdapter.CleanupFolders( Common.GetConfigurationPropertyValue("Sender", this.Site), Common.GetConfigurationPropertyValue("SenderPassword", this.Site), this.Domain, this.Subject, "drafts"); Site.Assert.IsTrue(isClear, "Sender's drafts folder should be cleaned up."); #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_S07_TC01_VerifyMessageWithAllOptionalElements() { #region Create a message #region define a CreateItem request with all elements except ReceivedBy and ReceivedRepresenting elements CreateItemType createItemRequest = new CreateItemType { MessageDisposition = MessageDispositionType.SaveOnly, // MessageDispositionSpecified value needs to be set. MessageDispositionSpecified = true, SavedItemFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.drafts } }, // Define the message which contains all the elements except ReceivedBy and ReceivedRepresenting. Items = new NonEmptyArrayOfAllItemsType { Items = new MessageType[] { // Create a MessageType instance with all element. new MessageType { // Specify the sender of the message. Sender = new SingleRecipientType { Item = new EmailAddressType { EmailAddress = this.Sender } }, // Specify the recipient of the message. ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } }, // Specify the recipient that receive a carbon copy of the message. CcRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient2 } }, // Specify the recipient that receive a blind carbon copy of the message. BccRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.MeetingRoom } }, // Specify the subject of message. Subject = this.Subject, // The sender of message does not request a read receipt. IsReadReceiptRequested = false, IsReadReceiptRequestedSpecified = true, // The sender of message does not request a delivery receipt. IsDeliveryReceiptRequested = false, IsDeliveryReceiptRequestedSpecified = true, // Response to the message is not requested. IsResponseRequested = false, IsResponseRequestedSpecified = true, // the message has not been read. IsRead = false, IsReadSpecified = true, // Specify the address from whom the message was sent. From = new SingleRecipientType { Item = new EmailAddressType { EmailAddress = this.Sender } }, // Specify the address to which replies should be sent. ReplyTo = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient2 } }, // Specify the Usenet header that is used to correlate replies with their original message. References = this.MsgReference, } } }, }; #endregion 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); #endregion #region Get the created message via itemIdType in above steps GetItemType getItemRequest = DefineGeneralGetItemRequestMessage(this.firstItemOfFirstInfoItem.ItemId, DefaultShapeNamesType.AllProperties); GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(getItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), this.infoItems[0].MessageText, null); MessageType messageItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0) as MessageType; Site.Assert.IsNotNull(messageItem, @"The first item of the array of ItemType type returned from server response should not be null."); #region Verify the child elements of the MessageType // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R2516, expected the length of EmailAddress is greater than zero, actual length is {0}", messageItem.Sender.Item.EmailAddress.Length); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R2516 // The type of the EmailAddress is verified in adapter capture code, only need to check whether this string has a minimum of one character. this.Site.CaptureRequirementIfIsTrue( messageItem.Sender.Item.EmailAddress.Length > 0, 2516, @"[In t:MessageType Complex Type] When the Mailbox element of Sender element include an EmailAddress element of t:NonEmptyStringType, the t:NonEmptyStringType simple type specifies a string that MUST have a minimum of one character."); if (Common.IsRequirementEnabled(1428001, this.Site)) { this.Site.CaptureRequirementIfAreEqual<MailboxTypeType>( MailboxTypeType.Mailbox, messageItem.Sender.Item.MailboxType, 2512, @"[In t:MessageType Complex Type] When the Mailbox element of Sender element include an MailboxType element of t:MailboxTypeType, the value ""Mailbox"" of t:MailboxTypeType specifies a mail-enabled directory service object."); } Site.Assert.AreEqual<string>(this.Sender.ToLower(), messageItem.Sender.Item.EmailAddress.ToLower(), "The EmailAddress of the Sender element in GetItem response should be equal with the settings"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R26"); // The type of the EmailAddress is verified in adapter capture code, only need to check whether this string has a minimum of one character. this.Site.CaptureRequirement( 26, @"[In t:MessageType Complex Type] The Sender element Specifies the sender of a message."); Site.Assert.AreEqual<string>(this.Sender.ToLower(), messageItem.From.Item.EmailAddress.ToLower(), "The EmailAddress of the From element in GetItem response should be equal to the settings"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R53"); // Each user has his own EmailAddress, if the above assert is passed, the following requirements can be captured directly. this.Site.CaptureRequirement( 53, @"[In t:MessageType Complex Type] From element Specifies the addressee from whom the message was sent."); // The messageRequest is used to save the message in request to create. MessageType messageRequest = createItemRequest.Items.Items[0] as MessageType; Site.Assert.IsNotNull(messageRequest, @"The CreateItem request should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R28"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R28 // This requirement can be verified since the createItem response message succeeded which indicates message was created successfully // and the sender value from getItem response is equal to the setting Sender element value in createItem request. Site.CaptureRequirementIfAreEqual<string>( messageRequest.Sender.Item.EmailAddress.ToLower(), messageItem.Sender.Item.EmailAddress.ToLower(), 28, @"[In t:MessageType Complex Type] [Sender element] This is a read/write element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R55"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R55 // This requirement can be verified since the createItem response message succeeded which indicates message was created successfully // and the From value from getItem response is equal to the setting From element value in createItem request. Site.CaptureRequirementIfAreEqual<string>( messageRequest.From.Item.EmailAddress.ToLower(), messageItem.From.Item.EmailAddress.ToLower(), 55, @"[In t:MessageType Complex Type] [From element] This is a read/write element."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R4200"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R4200 this.Site.CaptureRequirementIfIsFalse( messageItem.IsReadReceiptRequested, 4200, @"[In t:MessageType Complex Type] [IsReadReceiptRequested element] A text value of ""false"" indicates that a read receipt is not requested from the recipient of the message."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R4600"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R4600 this.Site.CaptureRequirementIfIsFalse( messageItem.IsDeliveryReceiptRequested, 4600, @"[In t:MessageType Complex Type] [IsDeliveryReceiptRequested element] A text value of ""false"" indicates that a delivery receipt has not been requested from the recipient of the message."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R6100"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R6100 this.Site.CaptureRequirementIfIsFalse( messageItem.IsRead, 6100, @"[In t:MessageType Complex Type] [IsRead element]The text value of ""false"" indicates that the message has not been read."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R6500"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R6500 this.Site.CaptureRequirementIfIsFalse( messageItem.IsResponseRequested, 6500, @"[In t:MessageType Complex Type] [IsResponseRequested element] A text value of ""false"" indicates that a response has not been requested."); #endregion #endregion #region Clean up Sender's drafts folder bool isClear = this.MSGSUTControlAdapter.CleanupFolders( Common.GetConfigurationPropertyValue("Sender", this.Site), Common.GetConfigurationPropertyValue("SenderPassword", this.Site), this.Domain, this.Subject, "drafts"); Site.Assert.IsTrue(isClear, "Sender's drafts folder should be cleaned up."); #endregion }
/// <summary> /// Verify the ItemType structure. /// </summary> /// <param name="item">An ItemType instance.</param> private void VerifyItemType(ItemType item) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R67"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R67 // The schema is validated and the item is not null, so this requirement can be captured. Site.CaptureRequirementIfIsNotNull( item, 67, @"[In t:ItemType Complex Type] [The type ItemType is defined as follow:] <xs:complexType name=""ItemType""> <xs:sequence> <xs:element name=""MimeContent"" type=""t:MimeContentType"" minOccurs=""0""/> <xs:element name=""ItemId"" type=""t:ItemIdType"" minOccurs=""0""/> <xs:element name=""ParentFolderId"" type=""t:FolderIdType"" minOccurs=""0""/> <xs:element name=""ItemClass"" type=""t:ItemClassType"" minOccurs=""0""/> <xs:element name=""Subject"" type=""xs:string"" minOccurs=""0""/> <xs:element name=""Sensitivity"" type=""t:SensitivityChoicesType"" minOccurs=""0""/> <xs:element name=""Body"" type=""t:BodyType"" minOccurs=""0""/> <xs:element name=""Attachments"" type=""t:NonEmptyArrayOfAttachmentsType"" minOccurs=""0""/> <xs:element name=""DateTimeReceived"" type=""xs:dateTime"" minOccurs=""0""/> <xs:element name=""Size"" type=""xs:int"" minOccurs=""0""/> <xs:element name=""Categories"" type=""t:ArrayOfStringsType"" minOccurs=""0""/> <xs:element name=""Importance"" type=""t:ImportanceChoicesType"" minOccurs=""0""/> <xs:element name=""InReplyTo"" type=""xs:string"" minOccurs=""0""/> <xs:element name=""IsSubmitted"" type=""xs:boolean"" minOccurs=""0""/> <xs:element name=""IsDraft"" type=""xs:boolean"" minOccurs=""0""/> <xs:element name=""IsFromMe"" type=""xs:boolean"" minOccurs=""0""/> <xs:element name=""IsResend"" type=""xs:boolean"" minOccurs=""0""/> <xs:element name=""IsUnmodified"" type=""xs:boolean"" minOccurs=""0""/> <xs:element name=""InternetMessageHeaders"" type=""t:NonEmptyArrayOfInternetHeadersType"" minOccurs=""0""/> <xs:element name=""DateTimeSent"" type=""xs:dateTime"" minOccurs=""0""/> <xs:element name=""DateTimeCreated"" type=""xs:dateTime"" minOccurs=""0""/> <xs:element name=""ResponseObjects"" type=""t:NonEmptyArrayOfResponseObjectsType"" minOccurs=""0""/> <xs:element name=""ReminderDueBy"" type=""xs:dateTime"" minOccurs=""0""/> <xs:element name=""ReminderIsSet"" type=""xs:boolean"" minOccurs=""0""/> <xs:element name=""ReminderNextTime"" type=""xs:dateTime"" minOccurs=""0""/> <xs:element name=""ReminderMinutesBeforeStart"" type=""t:ReminderMinutesBeforeStartType"" minOccurs=""0""/> <xs:element name=""DisplayCc"" type=""xs:string"" minOccurs=""0""/> <xs:element name=""DisplayTo"" type=""xs:string"" minOccurs=""0""/> <xs:element name=""HasAttachments"" type=""xs:boolean"" minOccurs=""0""/> <xs:element name=""ExtendedProperty"" type=""t:ExtendedPropertyType"" minOccurs=""0"" maxOccurs=""unbounded""/> <xs:element name=""Culture"" type=""xs:language"" minOccurs=""0""/> <xs:element name=""EffectiveRights"" type=""t:EffectiveRightsType"" minOccurs=""0""/> <xs:element name=""LastModifiedName"" type=""xs:string"" minOccurs=""0""/> <xs:element name=""LastModifiedTime"" type=""xs:dateTime"" minOccurs=""0""/> <xs:element name=""IsAssociated"" type=""xs:boolean"" minOccurs=""0""/> <xs:element name=""WebClientReadFormQueryString"" type=""xs:string"" minOccurs=""0""/> <xs:element name=""WebClientEditFormQueryString"" type=""xs:string"" minOccurs=""0""/> <xs:element name=""ConversationId"" type=""t:ItemIdType"" minOccurs=""0""/> <xs:element name=""UniqueBody"" type=""t:BodyType"" minOccurs=""0""/> <xs:element name=""Flag"" type=""t:FlagType"" minOccurs=""0""/> <xs:element name=""StoreEntryId"" type=""xs:base64Binary"" minOccurs=""0""/> <xs:element name=""InstanceKey"" type=""xs:base64Binary"" minOccurs=""0""/> <xs:element name=""NormalizedBody"" type=""t:BodyType"" minOccurs=""0""/> <xs:element name=""EntityExtractionResult"" type=""t:EntityExtractionResultType"" minOccurs=""0"" /> <xs:element name=""PolicyTag"" type=""t:RetentionTagType"" minOccurs=""0""/> <xs:element name=""ArchiveTag"" type=""t:RetentionTagType"" minOccurs=""0""/> <xs:element name=""RetentionDate"" type=""xs:dateTime"" minOccurs=""0""/> <xs:element name=""Preview"" type=""xs:string"" minOccurs=""0""/> <xs:element name=""RightsManagementLicenseData"" type=""t:RightsManagementLicenseDataType"" minOccurs=""0"" /> <xs:element name=""NextPredictedAction"" type=""t:PredictedMessageActionType"" minOccurs=""0"" /> <xs:element name=""GroupingAction"" type=""t:PredictedMessageActionType"" minOccurs=""0""/> <xs:element name=""BlockStatus"" type=""xs:boolean"" minOccurs=""0"" /> <xs:element name=""HasBlockedImages"" type=""xs:boolean"" minOccurs=""0"" /> <xs:element name=""TextBody"" type=""t:BodyType"" minOccurs=""0""/> <xs:element name=""IconIndex"" type=""t:IconIndexType"" minOccurs=""0""/> </xs:sequence> </xs:complexType>"); if (item.Body != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1096"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1096 // The schema is validated and the Body is not null, so this requirement can be captured. Site.CaptureRequirement( "MS-OXWSCDATA", 1096, @"[In t:BodyType Complex Type] The type [BodyType] is defined as follow: <xs:complexType name=""BodyType""> <xs:simpleContent> <xs:extension base=""xs:string"" > <xs:attribute name=""BodyType"" type=""t:BodyTypeType""/> xs:attribute name=""IsTruncated"" type=""xs:boolean"" use=""optional""/> </xs:extension> </xs:simpleContent> </xs:complexType>"); } if (item.ExtendedProperty != null) { this.VerifyExtendedPropertyType(item.ExtendedProperty); } if (item.MimeContent != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R112"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R112 // If schema is validated, and the MimeContent element is not null, // this requirement can be validated. Site.CaptureRequirement( 112, @"[In t:MimeContentType Complex Type] [The type MimeContentType is defined as follow:] <xs:complexType name=""MimeContentType""> <xs:simpleContent> <xs:extension base=""xs:string"" > <xs:attribute name=""CharacterSet"" type=""xs:string"" use=""optional"" /> </xs:extension> </xs:simpleContent> </xs:complexType>"); } if (item.Flag != null) { if (Common.IsRequirementEnabled(1271, this.Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1271"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1271 // The schema is validated and the Flag is not null, so this requirement can be captured. Site.CaptureRequirement( 1271, @"[In Appendix C: Product Behavior] Implementation does support FlagType complex type which specifies a flag indicating status, start date, due date or completion date for an item. (Exchange and above follow this behavior.) <xs:complexType name=""FlagType""> <xs:sequence> <xs:element name=""FlagStatus"" type=""t:FlagStatusType"" minOccurs=""1"" maxOccurs=""1""/> <xs:element name=""StartDate"" type=""xs:dateTime"" minOccurs=""0""/> <xs:element name=""DueDate"" type=""xs:dateTime"" minOccurs=""0""/> <xs:element name=""CompleteDate"" type=""xs:dateTime"" minOccurs=""0""/> </xs:sequence> </xs:complexType>"); } } if (item.EntityExtractionResult != null) { this.VerifyEntityExtractionResultType(item.EntityExtractionResult); } if (item.ResponseObjects != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R126"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R126 // The schema is validated and the ResponseObjects is not null, so this requirement can be captured. Site.CaptureRequirement( 126, @"[In t:NonEmptyArrayOfResponseObjectsType Complex Type] [The type NonEmptyArrayOfResponseObjectsType is defined as follow:] <xs:complexType name=""NonEmptyArrayOfResponseObjectsType""> <xs:choice maxOccurs=""unbounded"" minOccurs=""0"" > <xs:element name=""AcceptItem"" type=""t:AcceptItemType"" /> <xs:element name=""TentativelyAcceptItem"" type=""t:TentativelyAcceptItemType"" /> <xs:element name=""DeclineItem"" type=""t:DeclineItemType"" /> <xs:element name=""ReplyToItem"" type=""t:ReplyToItemType"" /> <xs:element name=""ForwardItem"" type=""t:ForwardItemType"" /> <xs:element name=""ReplyAllToItem"" type=""t:ReplyAllToItemType"" /> <xs:element name=""CancelCalendarItem"" type=""t:CancelCalendarItemType"" /> <xs:element name=""RemoveItem"" type=""t:RemoveItemType"" /> <xs:element name=""SuppressReadReceipt"" type=""t:SuppressReadReceiptType"" /> <xs:element name=""PostReplyItem"" type=""t:PostReplyItemType"" /> <xs:element name=""AcceptSharingInvitation"" type=""t:AcceptSharingInvitationType"" /> <xs:element name=""AddItemToMyCalendar"" type=""t:AddItemToMyCalendarType"" /> <xs:element name=""ProposeNewTime"" type=""t:ProposeNewTimeType"" /> </xs:choice> </xs:complexType>"); foreach (ResponseObjectType responseObject in item.ResponseObjects) { this.VerifyResponseObjectType(responseObject); } } if (item.ItemId != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R154"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R154 // The schema is validated and the ItemId is not null, so this requirement can be captured. Site.CaptureRequirement( 154, @"[In t:ItemIdType Complex Type] [The type ItemIdType is defined as follow:] <xs:complexType name=""ItemIdType""> <xs:complexContent> <xs:extension base=""t:BaseItemIdType"" > <xs:attribute name=""Id"" type=""xs:string"" use=""required"" /> <xs:attribute name=""ChangeKey"" type=""xs:string"" use=""optional"" /> </xs:extension> </xs:complexContent> </xs:complexType>"); } if (item.ImportanceSpecified) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R196"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R196 // The schema is validated and the ImportanceSpecified is true, so this requirement can be captured. Site.CaptureRequirement( 196, @"[In t:ImportanceChoicesType Simple Type] [The type ImportanceChoicesType is defined as follow:] <xs:simpleType name=""ImportanceChoicesType""> <xs:restriction base=""xs:string"" > <xs:enumeration value=""High"" /> <xs:enumeration value=""Low"" /> <xs:enumeration value=""Normal"" /> </xs:restriction> </xs:simpleType>"); } if (item.ItemClass != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R202"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R202 // The schema is validated and the ItemClass element is not null, so this requirement can be captured. Site.CaptureRequirement( 202, @"[In t:ItemClassType Simple Type] [The type ItemClassType is defined as follow:] <xs:simpleType name=""ItemClassType""> <xs:restriction base=""xs:string"" /> </xs:simpleType>"); } if (item.ReminderMinutesBeforeStart != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R204"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R204 // The schema is validated and the ReminderMinutesBeforeStart element is not null, so this requirement can be captured. Site.CaptureRequirement( 204, @"[In t:ReminderMinutesBeforeStartType Simple Type] [The type ReminderMinutesBeforeStartType is defined as follow:] <xs:simpleType name=""ReminderMinutesBeforeStartType""> <xs:union> <xs:simpleType id=""ReminderMinutesBeforeStartType"" > <xs:restriction base=""xs:int"" > <xs:minInclusive value=""0"" /> <xs:maxInclusive value=""2629800"" /> </xs:restriction> </xs:simpleType> <xs:simpleType id=""ReminderMinutesBeforeStartMarkerType"" > <xs:restriction base=""xs:int"" > <xs:minInclusive value=""1525252321"" /> <xs:maxInclusive value=""1525252321"" /> </xs:restriction> </xs:simpleType> </xs:union> </xs:simpleType>"); } if (item.Body != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R20"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R20 // The schema is validated and the Body element is not null, so this requirement can be captured. Site.CaptureRequirement( "MS-OXWSCDATA", 20, @"[In t:BodyTypeType Simple Type] This type [BodyTypeType] is defined as follow: <xs:simpleType name=""BodyTypeType""> <xs:restriction base=""xs:string"" > <xs:enumeration value=""HTML"" /> <xs:enumeration value=""Text"" /> </xs:restriction> </xs:simpleType>"); } if (item.SensitivitySpecified) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R783"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R783 // The schema is validated and the SensitivitySpecified is true, so this requirement can be captured. Site.CaptureRequirement( "MS-OXWSCDATA", 783, @"[In t:SensitivityChoicesType Simple Type] The type [SensitivityChoicesType] is defined as follow: <xs:simpleType name=""SensitivityChoicesType""> <xs:restriction base=""xs:string""> <xs:enumeration value=""Confidential""/> <xs:enumeration value=""Normal""/> <xs:enumeration value=""Personal""/> <xs:enumeration value=""Private""/> </xs:restriction> </xs:simpleType>"); } if (item.Categories != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1081"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1081 // The schema is validated and the Categories is not null, so this requirement can be captured. Site.CaptureRequirement( "MS-OXWSCDATA", 1081, @"[In t:ArrayOfStringsType Complex Type] The type [ArrayOfStringsType] is defined as follow: <xs:complexType name=""ArrayOfStringsType""> <xs:sequence> <xs:element name=""String"" type=""xs:string"" minOccurs=""0"" maxOccurs=""unbounded"" /> </xs:sequence> </xs:complexType>"); } if (item.EffectiveRights != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1129"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1129 // The schema is validated and the EffectiveRights is not null, so this requirement can be captured. Site.CaptureRequirement( "MS-OXWSCDATA", 1129, @"[In t:EffectiveRightsType Complex Type] The type [EffectiveRightsType] is defined as follow: <xs:complexType name=""EffectiveRightsType""> <xs:sequence> <xs:element name=""CreateAssociated"" type=""xs:boolean"" /> <xs:element name=""CreateContents"" type=""xs:boolean"" /> <xs:element name=""CreateHierarchy"" type=""xs:boolean"" /> <xs:element name=""Delete"" type=""xs:boolean"" /> <xs:element name=""Modify"" type=""xs:boolean"" /> <xs:element name=""Read"" type=""xs:boolean"" /> <xs:element name=""ViewPrivateItems"" type=""xs:boolean"" /> </xs:sequence> </xs:complexType>"); } if (item.ParentFolderId != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1165"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1165 // The schema is validated and the ParentFolderId is not null, so this requirement can be captured. Site.CaptureRequirement( "MS-OXWSCDATA", 1165, @"[In t:FolderIdType Complex Type] The type [FolderIdType] is defined as follow: <xs:complexType name=""FolderIdType""> <xs:complexContent> <xs:extension base=""t:BaseFolderIdType"" > <xs:attribute name=""Id"" type=""xs:string"" use=""required"" /> <xs:attribute name=""ChangeKey"" type=""xs:string"" use=""optional"" /> </xs:extension> </xs:complexContent> </xs:complexType>"); } if (item.InternetMessageHeaders != null) { foreach (InternetHeaderType internetMessageHeader in item.InternetMessageHeaders) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1175"); // Verify MS-OXWSCDATA requirement: MS-OXWSCDATA_R1175 // The schema is validated and the internetMessageHeader is not null, so this requirement can be captured. Site.CaptureRequirementIfIsNotNull( internetMessageHeader, "MS-OXWSCDATA", 1175, @"[In t:InternetHeaderType Complex Type] The type [InternetHeaderType] is defined as follow: <xs:complexType name=""InternetHeaderType""> <xs:simpleContent> <xs:extension base=""xs:string"" > <xs:attribute name=""HeaderName"" type=""xs:string"" use=""required"" /> </xs:extension> </xs:simpleContent> </xs:complexType>"); } } }
public void MSOXWSMSG_S07_TC05_VerifyInternetMessageIdIsReadOnly() { #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 returned 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 update InternetMessageId property of the original message UpdateItemType updateItemRequest = new UpdateItemType { MessageDisposition = MessageDispositionType.SaveOnly, MessageDispositionSpecified = true, ItemChanges = new ItemChangeType[] { new ItemChangeType { Item = itemIdType, Updates = new ItemChangeDescriptionType[] { new SetItemFieldType { Item = new PathToUnindexedFieldType { FieldURI = UnindexedFieldURIType.messageInternetMessageId }, Item1 = new MessageType { InternetMessageId = "InternetMessageId" } } } } } }; UpdateItemResponseType updateItemResponse = this.MSGAdapter.UpdateItem(updateItemRequest); Site.Assert.AreEqual<ResponseCodeType>(ResponseCodeType.ErrorInvalidPropertySet, updateItemResponse.ResponseMessages.Items[0].ResponseCode, "Since InternetMessageId is read-only, then the The ErrorInvalidPropertySet should be returned by server."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R58"); // If the above steps are pass, the R58 will be verified. this.Site.CaptureRequirement( 58, @"[In t:MessageType Complex Type] [InternetMessageId element] This element is read-only."); #endregion #region Clean up Sender's drafts folder bool isClear = this.MSGSUTControlAdapter.CleanupFolders( Common.GetConfigurationPropertyValue("Sender", this.Site), Common.GetConfigurationPropertyValue("SenderPassword", this.Site), this.Domain, this.Subject, "drafts"); Site.Assert.IsTrue(isClear, "Sender's drafts folder should be cleaned up."); #endregion }
public void MSOXWSMSG_S01_TC08_GetMessageWithBodyTypeAndAdditionProperties() { #region Create a message. #region Define a CreateItem request CreateItemType createItemRequest = new CreateItemType { MessageDisposition = MessageDispositionType.SaveOnly, // MessageDispositionSpecified value needs to be set. MessageDispositionSpecified = true, SavedItemFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.drafts } }, // Define the message which contains all the elements except ReceivedBy and ReceivedRepresenting. Items = new NonEmptyArrayOfAllItemsType { Items = new MessageType[] { // Create a MessageType instance with all element. new MessageType { // Specify the recipient of the message. ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } }, // Specify the subject of message. Subject = this.Subject, Body = new BodyType() { BodyType1 = BodyTypeType.HTML, Value = "<html><body><b>Bold</b>test</body></html>" } } } }, }; #endregion 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); #endregion #region Get the created message via itemIdType in above steps #region Send the GetItem requst which the BodyType element is set to text. GetItemType getItemRequest = new GetItemType { ItemIds = new ItemIdType[] { this.firstItemOfFirstInfoItem.ItemId }, ItemShape = new ItemResponseShapeType { BaseShape = DefaultShapeNamesType.AllProperties, BodyType = BodyTypeResponseType.Text, BodyTypeSpecified = true, } }; GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), "The response of the GetItem should be valid."); MessageType message = ((ItemInfoResponseMessageType)getItemResponse.ResponseMessages.Items[0]).Items.Items[0] as MessageType; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1190"); this.Site.CaptureRequirementIfAreEqual<BodyTypeType>( BodyTypeType.Text, message.Body.BodyType1, "MS-OXWSCDATA", 1190, @"[In t:ItemResponseShapeType Complex Type] The element ""BodyType"" with type ""t:BodyTypeResponseType(section 2.2.3.1)"" specifies the requested body text format for the Body property that is returned in a response."); #endregion #region Send the GetItem requst which the BaseShape element is set to IdOnly and addition the subject property. getItemRequest.ItemShape.BaseShape = DefaultShapeNamesType.IdOnly; getItemRequest.ItemShape.AdditionalProperties = new BasePathToElementType[] { new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemSubject, } }; getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), @"Server should return success for getting the email messages."); message = ((ItemInfoResponseMessageType)getItemResponse.ResponseMessages.Items[0]).Items.Items[0] as MessageType; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1197"); this.Site.CaptureRequirementIfIsTrue( string.IsNullOrEmpty(message.Subject) == false, "MS-OXWSCDATA", 1197, @"[In t:ItemResponseShapeType Complex Type] The element ""AdditionalProperties"" with type ""t:NonEmptyArrayOfPathsToElementType"" specifies a set of requested additional properties to return in a response."); #endregion #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 }
public void MSOXWSMSG_S07_TC07_VerifyReceivedRepresentingIsReadOnly() { #region Create a message which include the ReceivedRepresenting element. 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 { Items = new MessageType[] { // Create a MessageType instance with all element. new MessageType { // Specify the sender of the message. Sender = new SingleRecipientType { Item = new EmailAddressType { EmailAddress = this.Sender } }, // Specify the recipient of the message. ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } }, ReceivedRepresenting = new SingleRecipientType() { Item = new EmailAddressType { EmailAddress = this.Recipient1 } } } } }, }; CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest); Site.Assert.AreEqual<ResponseCodeType>(ResponseCodeType.ErrorInvalidPropertySet, createItemResponse.ResponseMessages.Items[0].ResponseCode, "Since ReceivedRepresenting is read-only, then the The ErrorInvalidPropertySet should be returned by server."); #endregion #region Create message createItemRequest = this.GetCreateItemType(MessageDispositionType.SaveOnly, DistinguishedFolderIdNameType.drafts); 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 returned 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 update ReceivedRepresenting property of the original message UpdateItemType updateItemRequest = new UpdateItemType { MessageDisposition = MessageDispositionType.SaveOnly, MessageDispositionSpecified = true, ItemChanges = new ItemChangeType[] { new ItemChangeType { Item = itemIdType, Updates = new ItemChangeDescriptionType[] { new SetItemFieldType { Item = new PathToUnindexedFieldType { FieldURI = UnindexedFieldURIType.messageReceivedRepresenting }, Item1 = new MessageType { ReceivedRepresenting = new SingleRecipientType() { Item = new EmailAddressType() { EmailAddress = this.Recipient1 } } } } } } } }; UpdateItemResponseType updateItemResponse = this.MSGAdapter.UpdateItem(updateItemRequest); Site.Assert.AreEqual<ResponseCodeType>(ResponseCodeType.ErrorInvalidPropertySet, updateItemResponse.ResponseMessages.Items[0].ResponseCode, "Since ReceivedRepresenting is read-only, then the The ErrorInvalidPropertySet should be returned by server."); #endregion // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R73001"); // If the above steps are pass, the R73001 will be verified. this.Site.CaptureRequirement( 73001, @"[In t:MessageType Complex Type] [ReceivedRepresenting element] This element is read-only."); #region Clean up Sender's drafts folder bool isClear = this.MSGSUTControlAdapter.CleanupFolders( Common.GetConfigurationPropertyValue("Sender", this.Site), Common.GetConfigurationPropertyValue("SenderPassword", this.Site), this.Domain, this.Subject, "drafts"); Site.Assert.IsTrue(isClear, "Sender's drafts folder should be cleaned up."); #endregion }
public void MSOXWSMSG_S01_TC02_CreateMessageWithMessageDispositionTypeSaveOnly() { #region Sender creates a message CreateItemType createItemRequestOfMessage = GetCreateItemType(MessageDispositionType.SaveOnly, DistinguishedFolderIdNameType.inbox); CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequestOfMessage); 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); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R82"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R82 // This requirement can be verified when the ItemId of message responseMessageItem got from the createItem response is not null which indicates the responseMessageItem identifier is returned. Site.CaptureRequirementIfIsNotNull( this.firstItemOfFirstInfoItem.ItemId, 82, @"[In t:MessageDispositionType Simple Type] [when ""SaveOnly"" used in CreateItem Type element] In this case, an item identifier is returned."); #endregion #region Sender gets the message GetItemType getItemRequest = DefineGeneralGetItemRequestMessage(this.firstItemOfFirstInfoItem.ItemId, DefaultShapeNamesType.AllProperties); GetItemResponseType getItemResponseOfMessage = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponseOfMessage), @"Server should return success for getting the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(getItemResponseOfMessage); Site.Assert.IsNotNull(this.infoItems, @"The CreateItem response should contain one or more items of ItemInfoResponseMessageType."); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); #endregion #region Sender finds the message in the inbox folder bool findItemResult = this.SearchItems(Role.Sender, "inbox", this.Subject, "itemSubject"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R80"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R80 // This requirement can be verified since the message created using SaveOnly can be sent successfully by using the SendItem operation. Site.CaptureRequirementIfIsTrue( findItemResult, 80, @"[In t:MessageDispositionType Simple Type] The value ""SaveOnly"" means when used in the CreateItemType complex type ([MS-OXWSCORE] section 3.1.4.2.3.2), the email message item is saved in the folder that is specified by the TargetFolderIdType complex type ([MS-OXWSFOLD] section 2.2.4.16)."); #endregion #region Sender sends the created message SendItemType sendItemRequest = new SendItemType { ItemIds = new ItemIdType[] { this.firstItemOfFirstInfoItem.ItemId }, SaveItemToFolder = true, SavedItemFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.sentitems } } }; SendItemResponseType sendItemResponse = this.MSGAdapter.SendItem(sendItemRequest); Site.Assert.IsTrue(this.VerifyResponse(sendItemResponse), @"Server should return success for sending the email messages."); #endregion #region Recipient1 verifies if the message has been received findItemResult = this.SearchItems(Role.Recipient1, "inbox", this.Subject, "itemSubject"); Site.Assert.IsTrue(findItemResult, "The item should be found in the inbox folder of Recipient1."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R81"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R81 // This requirement can be verified since the message created using SaveOnly can be sent successfully by using the SendItem operation. Site.CaptureRequirementIfIsTrue( findItemResult, 81, @"[In t:MessageDispositionType Simple Type] [when ""SaveOnly"" used in CreateItem Type element] Messages can be sent later by using the SendItem operation (section 3.1.4.7) on an ExchangeServiceBinding object."); #endregion #region Clean up Sender's sentitems folder and Recipient1's inbox folder bool isClear = this.MSGSUTControlAdapter.CleanupFolders( Common.GetConfigurationPropertyValue("Sender", this.Site), Common.GetConfigurationPropertyValue("SenderPassword", this.Site), this.Domain, this.Subject, "sentitems"); Site.Assert.IsTrue(isClear, "Sender's sentitems folder should be cleaned up."); isClear = this.MSGSUTControlAdapter.CleanupFolders( Common.GetConfigurationPropertyValue("Recipient1", this.Site), Common.GetConfigurationPropertyValue("Recipient1Password", this.Site), this.Domain, this.Subject, "inbox"); Site.Assert.IsTrue(isClear, "Recipient1's inbox folder should be cleaned up."); #endregion }
/// <summary> /// Update an occurrence of a recurring meeting. /// </summary> /// <param name="occurrence">The occurrence to be updated.</param> /// <returns>If update operation succeeds, return true; otherwise, false.</returns> private bool UpdateOccurrenceItem(ItemType occurrence) { ItemIdType occurrenceId = occurrence.ItemId; if (occurrenceId != null) { CalendarItemType calendarUpdate = new CalendarItemType(); calendarUpdate.Location = this.LocationUpdate; // Location change info AdapterHelper locationChangeInfo = new AdapterHelper(); locationChangeInfo.FieldURI = UnindexedFieldURIType.calendarLocation; locationChangeInfo.Item = new CalendarItemType() { Location = this.LocationUpdate }; locationChangeInfo.ItemId = occurrenceId; UpdateItemResponseMessageType itemOfLocationUpdate = this.UpdateSingleCalendarItem(Role.Organizer, locationChangeInfo, CalendarItemUpdateOperationType.SendOnlyToAll); Site.Assert.IsNotNull(itemOfLocationUpdate, "The location of the occurrence should be updated successfully."); CalendarItemType occurrenceOfLocationUpdate = itemOfLocationUpdate.Items.Items[0] as CalendarItemType; CalendarItemType calendar = occurrence as CalendarItemType; Site.Assert.IsNotNull(calendar, "The type conversion from ItemType to CalendarItemType should succeed."); // Start time change info DateTime start = calendar.Start; AdapterHelper startChangeInfo = new AdapterHelper(); startChangeInfo.FieldURI = UnindexedFieldURIType.calendarStart; startChangeInfo.Item = new CalendarItemType() { Start = start.AddHours(-26.0), StartSpecified = true }; startChangeInfo.ItemId = occurrenceOfLocationUpdate.ItemId; UpdateItemResponseMessageType itemOfStartUpdate = this.UpdateSingleCalendarItem(Role.Organizer, startChangeInfo, CalendarItemUpdateOperationType.SendOnlyToAll); Site.Assert.IsNotNull(itemOfStartUpdate, "The start time of the occurrence should be updated successfully."); CalendarItemType occurrenceOfStartUpdate = itemOfStartUpdate.Items.Items[0] as CalendarItemType; // End time change info DateTime end = calendar.End; AdapterHelper endChangeInfo = new AdapterHelper(); endChangeInfo.FieldURI = UnindexedFieldURIType.calendarEnd; endChangeInfo.Item = new CalendarItemType() { End = end.AddHours(-26.0), EndSpecified = true }; endChangeInfo.ItemId = occurrenceOfStartUpdate.ItemId; UpdateItemResponseMessageType itemOfEndUpdate = this.UpdateSingleCalendarItem(Role.Organizer, endChangeInfo, CalendarItemUpdateOperationType.SendOnlyToAll); Site.Assert.IsNotNull(itemOfEndUpdate, "The end time of the occurrence should be updated successfully."); return true; } return false; }
public void MSOXWSMSG_S01_TC06_GetMessageWithIncludeMimeContent() { #region Create a message #region Define a CreateItem request CreateItemType createItemRequest = new CreateItemType { MessageDisposition = MessageDispositionType.SaveOnly, // MessageDispositionSpecified value needs to be set. MessageDispositionSpecified = true, SavedItemFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.drafts } }, // Define the message which contains all the elements except ReceivedBy and ReceivedRepresenting. Items = new NonEmptyArrayOfAllItemsType { Items = new MessageType[] { // Create a MessageType instance with all element. new MessageType { // Specify the recipient of the message. ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } }, // Specify the subject of message. Subject = this.Subject, } } }, }; #endregion 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); #endregion #region Get the created message via itemIdType in above steps #region Send the GetItem requst which the IncludeMimeContent is set true. GetItemType getItemRequest = new GetItemType { ItemIds = new ItemIdType[] { this.firstItemOfFirstInfoItem.ItemId }, ItemShape = new ItemResponseShapeType { BaseShape = DefaultShapeNamesType.AllProperties, IncludeMimeContent = true, IncludeMimeContentSpecified = true, } }; GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), "The response of the GetItem should be valid."); MessageType message = ((ItemInfoResponseMessageType)getItemResponse.ResponseMessages.Items[0]).Items.Items[0] as MessageType; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R21188"); this.Site.CaptureRequirementIfIsNotNull( message.MimeContent, "MS-OXWSCDATA", 21188, @"[In t:ItemResponseShapeType Complex Type] [IncludeMimeContent is] True, specifies the MIME content of an item is returned in a response."); #endregion #region Send the GetItem requst which the IncludeMimeContent is set false. getItemRequest.ItemShape.IncludeMimeContent = false; getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), @"Server should return success for getting the email messages."); message = ((ItemInfoResponseMessageType)getItemResponse.ResponseMessages.Items[0]).Items.Items[0] as MessageType; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R21189"); this.Site.CaptureRequirementIfIsNull( message.MimeContent, "MS-OXWSCDATA", 21189, @"[In t:ItemResponseShapeType Complex Type] otherwise [IncludeMimeContent is] false, specifies [the MIME content of an item is not returned in a response]."); #endregion #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 }
/// <summary> /// Verify the validation of a response of CreateItem operation returned by server. /// </summary> /// <param name="createItemResponse">A response of CreateItem operation returned by server.</param> /// <param name="messageDisposition">A value specifies how a message item is handled after it is created or updated.</param> /// <returns>The validation result.</returns> protected bool VerifyCreateItemResponse(CreateItemResponseType createItemResponse, MessageDispositionType messageDisposition) { bool isValidCreateResponse = false; if (this.VerifyResponse(createItemResponse)) { this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse); Site.Assert.IsNotNull(this.infoItems, @"The CreateItem response should contain one or more items of ItemInfoResponseMessageType."); switch (messageDisposition) { case MessageDispositionType.SaveOnly: this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); isValidCreateResponse = true; break; case MessageDispositionType.SendAndSaveCopy: case MessageDispositionType.SendOnly: Site.Assert.IsTrue(this.infoItems.Length > 0, "infoItems instance should contain at least one item."); Site.Assert.IsNotNull(this.infoItems[0], "The first item of infoItems instance should not be null."); Site.Assert.IsNotNull(this.infoItems[0].Items, "The Items property of the first item of infoItems instance should not be null."); break; } isValidCreateResponse = true; } return isValidCreateResponse; }
public void MSOXWSSYNC_S02_TC10_SyncFolderItems_ItemType() { #region Step 1. Client invokes SyncFolderItems operation to get initial syncState of inbox folder. DistinguishedFolderIdNameType inboxFolder = DistinguishedFolderIdNameType.inbox; SyncFolderItemsType request = this.CreateSyncFolderItemsRequestWithoutOptionalElements(inboxFolder, DefaultShapeNamesType.AllProperties); SyncFolderItemsResponseType response = this.SYNCAdapter.SyncFolderItems(request); SyncFolderItemsResponseMessageType responseMessage = TestSuiteHelper.EnsureResponse<SyncFolderItemsResponseMessageType>(response); #endregion #region Step 2. Client invokes CreateItem to create a ItemType item and get its ID. ItemType item = new ItemType(); BaseItemIdType[] itemIds = this.CreateItem(inboxFolder, item); #endregion #region Step 3. Client invokes SyncFolderItems operation with previous SyncState to sync the operation result in Step 2. responseMessage = this.GetResponseMessage(inboxFolder, responseMessage, DefaultShapeNamesType.AllProperties); // Assert the changes in response is not null Site.Assert.IsNotNull(responseMessage.Changes, "There is one item created on server, so the changes between server and client should not be null"); SyncFolderItemsChangesType changes = responseMessage.Changes; // Assert both the Items and ItemsElementName are not null Site.Assert.IsNotNull(changes.ItemsElementName, "There should be changes information returned in SyncFolderItems response since there is one item created on server."); Site.Assert.IsNotNull(changes.Items, "There should be item information returned in SyncFolderItems response since there is one item created on server."); Site.Assert.AreEqual<int>(1, changes.ItemsElementName.Length, "Just one ItemType item was created in previous step, so the count of ItemsElementName array in responseMessage.Changes should be 1."); Site.Assert.IsTrue( changes.ItemsElementName[0] == ItemsChoiceType1.Create, string.Format("The responseMessage.Changes.ItemsElementName should be 'Create', the actual value is '{0}'", changes.ItemsElementName[0])); Site.Assert.AreEqual<int>(1, changes.Items.Length, "Just one ItemType item was created in previous step, so the count of Items array in responseMessage.Changes should be 1."); // If client creates an item of ItemType, a MessageType complex type is returned. Site.Assert.IsTrue( changes.Items[0].GetType() == typeof(SyncFolderItemsCreateOrUpdateType) && (changes.Items[0] as SyncFolderItemsCreateOrUpdateType).Item.GetType() == typeof(MessageType), string.Format("The responseMessage.Changes.Items should be an instance of '{0}' and the type of Item should be '{1}'.", typeof(SyncFolderItemsCreateOrUpdateType), typeof(MessageType))); if (Common.IsRequirementEnabled(37811004, this.Site)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWWSSYNC_R37811004"); this.Site.CaptureRequirementIfIsInstanceOfType( (changes.Items[0] as SyncFolderItemsCreateOrUpdateType).Item, typeof(MessageType), 37811004, @"[In Appendix C: Product Behavior] Implementation does return a MessageType complex type. (If a client creates an item of this type, a MessageType complex type is returned.)"); } #endregion #region Step 4. Client invokes UpdateItem operation to update the created item which created in Step 2. // Generate a new item subject string newItemSubject = Common.GenerateResourceName(this.Site, inboxFolder + "NewItemSubject"); this.UpdateItemSubject(itemIds, newItemSubject); #endregion #region Step 5. Client invokes SyncFolderItems operation with previous SyncState to sync the operation result in Step 4. responseMessage = this.GetResponseMessage(inboxFolder, responseMessage, DefaultShapeNamesType.AllProperties); // Assert the changes in response is not null Site.Assert.IsNotNull(responseMessage.Changes, "There is one item updated on server, so the changes between server and client should not be null"); changes = responseMessage.Changes; // Assert both the Items and ItemsElementName are not null Site.Assert.IsNotNull(changes.ItemsElementName, "There should be changes information returned in SyncFolderItems response since there is one item updated on server."); Site.Assert.IsNotNull(changes.Items, "There should be item information returned in SyncFolderItems response since there is one item updated on server."); Site.Assert.AreEqual<int>(1, changes.ItemsElementName.Length, "Just one ItemType item was updated in previous step, so the count of ItemsElementName array in responseMessage.Changes should be 1."); Site.Assert.IsTrue( changes.ItemsElementName[0] == ItemsChoiceType1.Update, string.Format("The responseMessage.Changes.ItemsElementName should be 'Update', the actual value is '{0}'", changes.ItemsElementName[0])); Site.Assert.AreEqual<int>(1, changes.Items.Length, "Just one ItemType item was updated in previous step, so the count of Items array in responseMessage.Changes should be 1."); // If client creates an item of ItemType, a MessageType complex type is returned. Site.Assert.IsTrue( changes.Items[0].GetType() == typeof(SyncFolderItemsCreateOrUpdateType) && (changes.Items[0] as SyncFolderItemsCreateOrUpdateType).Item.GetType() == typeof(MessageType), string.Format("The responseMessage.Changes.Items should be an instance of '{0}' and the type of Item should be '{1}'.", typeof(SyncFolderItemsCreateOrUpdateType), typeof(MessageType))); #endregion #region Step 6. Client invokes DeleteItem operation to delete the ItemType item which updated in Step 4. this.DeleteItem(itemIds); #endregion #region Step 7. Client invokes SyncFolderItems operation with previous SyncState to sync the operation result in Step 6. responseMessage = this.GetResponseMessage(inboxFolder, responseMessage, DefaultShapeNamesType.AllProperties); // Assert the changes in response is not null Site.Assert.IsNotNull(responseMessage.Changes, "There is one item deleted on server, so the changes between server and client should not be null"); changes = responseMessage.Changes; // Assert both the Items and ItemsElementName are not null Site.Assert.IsNotNull(changes.ItemsElementName, "There should be changes information returned in SyncFolderItems response since there is one item deleted on server."); Site.Assert.IsNotNull(changes.Items, "There should be item information returned in SyncFolderItems response since there is one item deleted on server."); Site.Assert.AreEqual<int>(1, changes.ItemsElementName.Length, "Just one ItemType item was deleted in previous step, so the count of ItemsElementName array in responseMessage.Changes should be 1."); Site.Assert.IsTrue( changes.ItemsElementName[0] == ItemsChoiceType1.Delete, string.Format("The responseMessage.Changes.ItemsElementName should be 'Delete', the actual value is '{0}'", changes.ItemsElementName[0])); Site.Assert.AreEqual<int>(1, changes.Items.Length, "Just one ItemType item was deleted in previous step, so the count of Items array in responseMessage.Changes should be 1."); Site.Assert.IsTrue( changes.Items[0].GetType() == typeof(SyncFolderItemsDeleteType), string.Format("The responseMessage.Changes.Items should be an instance of '{0}'.", typeof(SyncFolderItemsDeleteType))); #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 }