示例#1
0
        public void MSASCMD_S11_TC08_Ping_WithoutRequestBody()
        {
            #region Call Ping command with request body
            PingRequest pingRequest = CreatePingRequest(this.User1Information.InboxCollectionId, Request.PingFolderClass.Email);
            pingRequest.RequestData.HeartbeatInterval = "60";
            PingResponse pingResponse = this.CMDAdapter.Ping(pingRequest);

            // According to techinical specification, if there were changes occurred in the Inbox folder, the Ping response would return 2.
            // Reissue the Ping command when the Sync command completes to stay up to date.
            int retryCount = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site));
            int waitTime   = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site));
            int counter    = 1;
            while (counter < retryCount && 2 == int.Parse(pingResponse.ResponseData.Status))
            {
                System.Threading.Thread.Sleep(waitTime);
                SyncRequest syncRequest = TestSuiteBase.CreateEmptySyncRequest(this.User1Information.InboxCollectionId);
                this.Sync(syncRequest);
                syncRequest.RequestData.Collections[0].SyncKey = this.LastSyncKey;
                this.Sync(syncRequest);

                pingResponse = this.CMDAdapter.Ping(pingRequest);
                counter++;
            }

            Site.Assert.AreEqual <int>(1, int.Parse(pingResponse.ResponseData.Status), "The Ping command should be successful.");
            #endregion

            #region Create a ping request without request body
            pingRequest             = new PingRequest();
            pingRequest.RequestData = null;
            #endregion

            #region Call Ping command
            pingResponse = this.CMDAdapter.Ping(pingRequest);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R335
            Site.CaptureRequirementIfAreEqual <int>(
                1,
                int.Parse(pingResponse.ResponseData.Status),
                335,
                @"[In Ping] A Ping command can be sent with no body, in which case the cached version is used.");
            #endregion
        }
        public void MSASCMD_S21_TC05_CommonStatusCode_164()
        {
            Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "Status value 164 is not returned when the MS-ASProtocolVersion header is set to 12.1. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            Site.Assume.AreNotEqual <string>("14.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "Status value 164 is not returned when the MS-ASProtocolVersion header is set to 14.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");

            #region User calls Sync command with option element

            // Set an unsupported Type element value in the BodyPartPreference node
            Request.Options option = new Request.Options
            {
                Items = new object[]
                {
                    new Request.BodyPartPreference()
                    {
                        // As specified in [MS-ASAIRS] section 2.2.2.22.3, only a value of 2 (HTML) SHOULD be used in the Type element of a BodyPartPreference element.
                        // Then '3' is an unsupported Type element value.
                        Type = 3
                    }
                },
                ItemsElementName = new Request.ItemsChoiceType1[] { Request.ItemsChoiceType1.BodyPartPreference }
            };

            SyncRequest syncRequest = TestSuiteBase.CreateEmptySyncRequest(this.User1Information.InboxCollectionId);
            this.Sync(syncRequest);

            syncRequest.RequestData.Collections[0].Options = new Request.Options[] { option };
            syncRequest.RequestData.Collections[0].SyncKey = this.LastSyncKey;
            SyncResponse syncResponse = this.Sync(syncRequest);

            #endregion

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5412
            Site.CaptureRequirementIfAreEqual <int>(
                164,
                int.Parse(syncResponse.ResponseData.Status),
                5412,
                @"[In Common Status Codes] [The meaning of the status value 164 is] The BodyPartPreference node (as specified in [MS-ASAIRS] section 2.2.2.7) has an unsupported Type element (as specified in [MS-ASAIRS] section 2.2.2.22.4) value.<98>");
        }