public void MSOXCNOTIF_S02_TC19_VerifyTableRestrictionChangedEvent()
{
this.CheckWhetherSupportMAPIHTTP();
this.NotificationInitialize();
Site.Assume.IsTrue(Common.IsRequirementEnabled(13201, this.Site), "This case runs only under Exchange 2007, since Exchange 2010 and Exchange 2013 implementation does not support TableRestrictionChanged events.");
#region Open Inbox folder and get content table of the Inbox folder
uint inboxTableHandle;
this.OpenFolder(this.InboxFolderId, out inboxTableHandle);
uint contentTableHandle;
this.GetContentsTable(inboxTableHandle, out contentTableHandle, false);
#endregion
#region Create table view by QueryPosition
// The properties need to be set
PropertyTag[] tags = new PropertyTag[]
{
PropertyTags.All[PropertyNames.PidTagInstID],
PropertyTags.All[PropertyNames.PidTagImportance],
PropertyTags.All[PropertyNames.PidTagInstanceNum],
PropertyTags.All[PropertyNames.PidTagFolderId],
PropertyTags.All[PropertyNames.PidTagMessageClass]
};
// Create table view by QueryPosition.
this.SetColumns(contentTableHandle, tags);
this.QueryPosition(contentTableHandle);
#endregion
#region Trigger TableRestrictionChanged event and get notification
this.RestrictTable(contentTableHandle, new byte[] { });
IList<IDeserializable> rsp = this.CNOTIFAdapter.GetNotification(true);
#endregion
#region Verify notification response for TableRestrictionChanged event
foreach (IDeserializable response in rsp)
{
Site.Assert.IsTrue(response.GetType() == typeof(RopNotifyResponse) || response.GetType() == typeof(RopPendingResponse), "The ROP response type should be RopNotifyResponse or RopPendingResponse.");
if (response is RopNotifyResponse)
{
RopNotifyResponse notifyResponse = (RopNotifyResponse)response;
Site.Assert.AreEqual<NotificationType>(NotificationType.TableModified, notifyResponse.NotificationData.NotificationType, "The notification type for the RopNotify response should be TableModified.");
Site.Assert.AreEqual<EventTypeOfTable>(EventTypeOfTable.TableRestrictionChanged, notifyResponse.NotificationData.TableEvent, "The table event type for the RopNotify response should be TableRestrictionChanged.");
this.VerifyTableModifyNotificationFlag(notifyResponse);
// Add the debug information
this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCNOTIF_R265");
this.Site.Assert.IsNull(
notifyResponse.NotificationData.TableRowFolderID,
"The server generates a basic notification should not have TableRowFolderID.");
this.Site.Assert.IsNull(
notifyResponse.NotificationData.TableRowMessageID,
"The server generates a basic notification should not have TableRowMessageID.");
// Verify MS-OXCNOTIF requirement: MS-OXCNOTIF_R265
// The server generates a basic notification and MS-OXCNOTIF_R265 can be verified directly.
this.Site.CaptureRequirement(
265,
@"[In Creating and Sending TableModified Event Notifications] [When a TableModified event occurs, the server generates a notification using one of the following three methods, listed in descending order of usefulness to the client.] For TableRestrictionChanged event, the server generates a basic notification that does not include specifics about the change made.");
this.Site.Assert.IsNotNull(notifyResponse.NotificationData.TableEventType, "TableEventType in the RopNotify response should not null.");
// Add the debug information
this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCNOTIF_R13201");
// Verify MS-OXCNOTIF requirement: MS-OXCNOTIF_R13201
this.Site.CaptureRequirementIfAreEqual<int>(
0x0007,
(int)notifyResponse.NotificationData.TableEventType,
13201,
@"[In NotificationData Structure] [TableEventType value] Implementation does support TableRestrictionChanged events (0x0007). (Exchange 2007 follows this behavior.)");
}
}
#endregion
}