Microsoft.Protocols.TestSuites.MS_OXCNOTIF.S02_SubscribeAndReceiveNotifications.MSOXCNOTIF_S02_TC17_VerifyTableChangedEvent C# (CSharp) Method

MSOXCNOTIF_S02_TC17_VerifyTableChangedEvent() private method

private MSOXCNOTIF_S02_TC17_VerifyTableChangedEvent ( ) : void
return void
        public void MSOXCNOTIF_S02_TC17_VerifyTableChangedEvent()
        {
            this.CheckWhetherSupportMAPIHTTP();
            this.NotificationInitialize();
            Site.Assume.IsTrue(Common.IsRequirementEnabled(128, this.Site), "This case runs only under Exchange 2007, since Exchange 2010 and Exchange 2013 implementation does not support TableChanged events.");

            #region Open Inbox folder and get content table of the Inbox folder
            uint inboxHandle;
            this.OpenFolder(this.InboxFolderId, out inboxHandle);
            uint contentTableHandle;
            this.GetContentsTable(inboxHandle, out contentTableHandle, false);
            #endregion

            #region Create table view by QueryColumnsAll
            // The properties need to be set
            PropertyTag[] tags = new PropertyTag[] { PropertyTags.All[PropertyNames.PidTagFolderId] };
            this.SetColumns(contentTableHandle, tags);

            // Retrieves rows from content table to get the data of row 1.
            this.QueryRows(contentTableHandle, 1);
            this.QueryColumnsAll(contentTableHandle);
            #endregion

            #region Trigger TableChanged event and get notification
            this.TriggerTableChangedEvent();
            IList<IDeserializable> rsp = this.CNOTIFAdapter.GetNotification(true);
            #endregion

            #region Verify notification response for TableChanged event
            if (Common.IsRequirementEnabled(128, this.Site))
            {
                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.TableChanged, notifyResponse.NotificationData.TableEvent, "The table event type for the RopNotify response should be TableChanged.");
                        this.VerifyTableModifyNotificationFlag(notifyResponse);
                        this.VerifyTableChangedNotificationElements(notifyResponse);

                        // Add the debug information
                        this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCNOTIF_R264");

                        Site.Assert.IsNull(notifyResponse.NotificationData.TableRowFolderID, "The TableRowFolderID of the basic notification should be null.");
                        Site.Assert.IsNull(notifyResponse.NotificationData.TableRowMessageID, "The TableRowMessageID of the basic notification should be null.");

                        // Verify MS-OXCNOTIF requirement: MS-OXCNOTIF_R264
                        this.Site.CaptureRequirement(
                            264,
                            @"[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 TableChanged event, the server generates a basic notification that does not include specifics about the change made.");

                        this.VerifyTriggerBasicNotification(true);

                        Site.Assert.IsNotNull(notifyResponse.NotificationData.TableEventType, "The TableEventType in the RopNotifyResponse should not null.");

                        // Add the debug information
                        this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCNOTIF_R128");

                        // Verify MS-OXCNOTIF requirement: MS-OXCNOTIF_R128
                        this.Site.CaptureRequirementIfAreEqual<int>(
                            0x0001,
                            (int)notifyResponse.NotificationData.TableEventType,
                            128,
                            @"[In NotificationData Structure] [TableEventType value] 0x0001: The notification is for TableChanged events.");

                        // Add the debug information
                        this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCNOTIF_R22");

                        // Verify MS-OXCNOTIF requirement: MS-OXCNOTIF_R22
                        // Client can receive TableChanged notification indicates that a table has been changed on the server.
                        this.Site.CaptureRequirementIfAreEqual<int>(
                            0x0001,
                            (int)notifyResponse.NotificationData.TableEventType,
                            22,
                            @"[In TableModified Event Types] TableChanged: A table has been changed.");
                    }
                }
            }
            #endregion
        }
S02_SubscribeAndReceiveNotifications