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
}