コード例 #1
0
        /// <summary>
        /// Gets an estimate of the number of items in the specific folder.
        /// </summary>
        /// <param name="syncKey">The latest SyncKey.</param>
        /// <param name="collectionId">The CollectionId of the folder.</param>
        /// <returns>The response of GetItemEstimate command.</returns>
        protected GetItemEstimateResponse CallGetItemEstimateCommand(string syncKey, string collectionId)
        {
            List <Request.ItemsChoiceType10> itemsElementName = new List <Request.ItemsChoiceType10>()
            {
                Request.ItemsChoiceType10.SyncKey,
                Request.ItemsChoiceType10.CollectionId,
            };

            List <object> items = new List <object>()
            {
                syncKey,
                collectionId,
            };

            if (Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site) != "12.1")
            {
                itemsElementName.Add(Request.ItemsChoiceType10.ConversationMode);
                items.Add(true);
            }
            // Create GetItemEstimate command request.
            Request.GetItemEstimateCollection collection = new Request.GetItemEstimateCollection
            {
                ItemsElementName = itemsElementName.ToArray(),
                Items            = items.ToArray()
            };

            GetItemEstimateRequest getItemEstimateRequest = Common.CreateGetItemEstimateRequest(new Request.GetItemEstimateCollection[] { collection });

            GetItemEstimateResponse getItemEstimateResponse = this.CONAdapter.GetItemEstimate(getItemEstimateRequest);

            return(getItemEstimateResponse);
        }
コード例 #2
0
        /// <summary>
        /// Gets an estimate of the number of items in the specific folder.
        /// </summary>
        /// <param name="syncKey">The latest SyncKey.</param>
        /// <param name="collectionId">The CollectionId of the folder.</param>
        /// <returns>The response of GetItemEstimate command.</returns>
        protected GetItemEstimateResponse CallGetItemEstimateCommand(string syncKey, string collectionId)
        {
            // Create GetItemEstimate command request.
            Request.GetItemEstimateCollection collection = new Request.GetItemEstimateCollection
            {
                CollectionId = collectionId,
                SyncKey      = syncKey
            };

            if (Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site) != "12.1")
            {
                collection.ConversationMode          = true;
                collection.ConversationModeSpecified = true;
            }

            GetItemEstimateRequest getItemEstimateRequest = Common.CreateGetItemEstimateRequest(new Request.GetItemEstimateCollection[] { collection });

            GetItemEstimateResponse getItemEstimateResponse = this.CONAdapter.GetItemEstimate(getItemEstimateRequest);

            return(getItemEstimateResponse);
        }
コード例 #3
0
        public void MSASCMD_S07_TC15_GetItemEstimate_Collection_LimitValue()
        {
            Site.Assume.AreNotEqual<string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Options element is not supported when the MS-ASProtocolVersion header is set to 12.1. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");

            #region Send an email from user1 to user2.
            string emailSubject = Common.GenerateResourceName(Site, "subject");
            this.SendPlainTextEmail(null, emailSubject, this.User1Information.UserName, this.User2Information.UserName, null);

            this.SwitchUser(this.User2Information);
            this.CheckEmail(this.User2Information.InboxCollectionId, emailSubject, null);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject);
            #endregion

            #region Create 1001 objects of GetItemEstimateCollection type for GetItemEstimate command.
            Request.Options option = new Request.Options
            {
                Items = new object[] { "Email" },
                ItemsElementName = new Request.ItemsChoiceType1[] { Request.ItemsChoiceType1.Class }
            };

            List<Request.GetItemEstimateCollection> collections = new List<Request.GetItemEstimateCollection>();
            for (int i = 0; i <= 1000; i++)
            {
                Request.GetItemEstimateCollection collection = new Request.GetItemEstimateCollection
                {
                    CollectionId = this.User2Information.InboxCollectionId,
                    SyncKey = this.LastSyncKey,
                    Options = new Request.Options[] { option }
                };

                collections.Add(collection);
            }

            GetItemEstimateRequest getItemEstimateRequest = Common.CreateGetItemEstimateRequest(collections.ToArray());
            GetItemEstimateResponse getItemEstimateResponse = this.CMDAdapter.GetItemEstimate(getItemEstimateRequest);
            Site.Assert.IsNotNull(getItemEstimateResponse.ResponseData, "The response data of GetItemEstimate command should not be null.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5647
            Site.CaptureRequirementIfAreEqual<int>(
                103,
                int.Parse(getItemEstimateResponse.ResponseData.Status),
                5647,
                @"[In Limiting Size of Command Requests] In GetItemEstimate (section 2.2.2.7) command request, when the limit value of Collection element is bigger than 1000 (minimum 30, maximum 5000), the error returned by server is Status element (section 2.2.3.162.6) value of 103.");
            #endregion
        }
コード例 #4
0
        /// <summary>
        /// This method is used to create GetItemEstimate request.
        /// </summary>
        /// <param name="syncKey">The synchronization state of a collection.</param>
        /// <param name="collectionId">The collection id of the folder.</param>
        /// <param name="options">Contains elements that filter the results.</param>
        /// <returns>The GetItemEstimate request.</returns>
        protected static GetItemEstimateRequest CreateGetItemEstimateRequest(string syncKey, string collectionId, Request.Options[] options)
        {
            Request.GetItemEstimateCollection collection = new Request.GetItemEstimateCollection
            {
                CollectionId = collectionId,
                SyncKey = syncKey
            };

            if (options != null)
            {
                collection.Options = options;
            }

            return Common.CreateGetItemEstimateRequest(new Request.GetItemEstimateCollection[] { collection });
        }