Microsoft.Protocols.TestSuites.MS_OXCNOTIF.MS_OXCNOTIFAdapter.GetNotification C# (CSharp) Method

GetNotification() public method

Retrieve the RopNotify and RopPending response by sending an empty RPC request.
public GetNotification ( bool expectGetNotification ) : IList
expectGetNotification bool A bool type indicating whether expect to get any notification.
return IList
        public IList<IDeserializable> GetNotification(bool expectGetNotification)
        {
            IList<IDeserializable> notification;
            List<List<uint>> responseSOHs;

            // If expectGetNotification is true, which means the notifications are expected. Do a loop to get notifications.
            // Otherwise, only get the notification once.
            if (expectGetNotification)
            {
                // The retry times to try getting notifications.
                int retryCount = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site));
                int sleepTime = int.Parse(Common.GetConfigurationPropertyValue("SleepTime", this.Site));
                do
                {
                    // Sleep some time to get pending notification and notification details,
                    // the sleep time is implementation-specific, which can be configured.
                    Thread.Sleep(sleepTime);

                    notification = this.Process(
                        null,
                        this.LogonHandle,
                        out responseSOHs);
                    retryCount--;
                }
                while (notification.Count == 0 && retryCount > 0);
                Site.Assert.AreNotEqual<int>(
                    0,
                    notification.Count,
                    "Failed to get the RopNotify and RopPending response.");
                foreach (IDeserializable rsp in notification)
                {
                    if (rsp is RopNotifyResponse)
                    {
                        RopNotifyResponse response = (RopNotifyResponse)rsp;
                        this.VerifyRopNotifyResponse(response);
                    }
                    else if (rsp is RopPendingResponse)
                    {
                        this.VerifyRopPendingResponse();
                    }

                    this.VerifyROPTransport();
                    this.VerifyMAPITransport();
                }
            }
            else
            {
                notification = this.Process(
                        null,
                        this.LogonHandle,
                        out responseSOHs);
            }

            return notification;
        }