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
}