Ejemplo n.º 1
0
        /// <summary>
        /// Update email
        /// </summary>
        /// <param name="collectionId">The collectionId of the folder which contains the item to be updated.</param>
        /// <param name="syncKey">The syncKey which is returned from server</param>
        /// <param name="read">The value is TRUE indicates the email has been read; a value of FALSE indicates the email has not been read</param>
        /// <param name="serverId">The server id of the email</param>
        /// <param name="flag">The flag instance</param>
        /// <param name="categories">The array of categories</param>
        /// <returns>Return update email result</returns>
        protected SyncStore UpdateEmail(string collectionId, string syncKey, bool?read, string serverId, Request.Flag flag, Collection <string> categories)
        {
            Request.SyncCollectionChange changeData = new Request.SyncCollectionChange
            {
                ServerId        = serverId,
                ApplicationData = new Request.SyncCollectionChangeApplicationData()
            };

            List <object> items = new List <object>();
            List <Request.ItemsChoiceType7> itemsElementName = new List <Request.ItemsChoiceType7>();

            if (null != read)
            {
                items.Add(read);
                itemsElementName.Add(Request.ItemsChoiceType7.Read);
            }

            if (null != flag)
            {
                items.Add(flag);
                itemsElementName.Add(Request.ItemsChoiceType7.Flag);
            }

            if (null != categories)
            {
                Request.Categories2 mailCategories = new Request.Categories2 {
                    Category = new string[categories.Count]
                };
                categories.CopyTo(mailCategories.Category, 0);
                items.Add(mailCategories);
                itemsElementName.Add(Request.ItemsChoiceType7.Categories2);
            }

            changeData.ApplicationData.Items            = items.ToArray();
            changeData.ApplicationData.ItemsElementName = itemsElementName.ToArray();

            SyncRequest syncRequest = TestSuiteHelper.CreateSyncChangeRequest(syncKey, collectionId, changeData);
            SyncStore   result      = this.EMAILAdapter.Sync(syncRequest);

            Site.Assert.AreEqual <byte>(
                1,
                result.CollectionStatus,
                "The server returns a Status 1 in the Sync command response indicate sync command success.");

            return(result);
        }
        /// <summary>
        /// Update email
        /// </summary>
        /// <param name="collectionId">The collectionId of the folder which contains the item to be updated.</param>
        /// <param name="syncKey">The syncKey which is returned from server</param>
        /// <param name="read">The value is TRUE indicates the email has been read; a value of FALSE indicates the email has not been read</param>
        /// <param name="serverId">The server id of the email</param>
        /// <param name="flag">The flag instance</param>
        /// <param name="categories">The array of categories</param>
        /// <returns>Return update email result</returns>
        protected SyncStore UpdateEmail(string collectionId, string syncKey, bool? read, string serverId, Request.Flag flag, Collection<string> categories)
        {
            Request.SyncCollectionChange changeData = new Request.SyncCollectionChange
            {
                ServerId = serverId,
                ApplicationData = new Request.SyncCollectionChangeApplicationData()
            };

            List<object> items = new List<object>();
            List<Request.ItemsChoiceType7> itemsElementName = new List<Request.ItemsChoiceType7>();

            if (null != read)
            {
                items.Add(read);
                itemsElementName.Add(Request.ItemsChoiceType7.Read);
            }

            if (null != flag)
            {
                items.Add(flag);
                itemsElementName.Add(Request.ItemsChoiceType7.Flag);
            }

            if (null != categories)
            {
                Request.Categories2 mailCategories = new Request.Categories2 { Category = new string[categories.Count] };
                categories.CopyTo(mailCategories.Category, 0);
                items.Add(mailCategories);
                itemsElementName.Add(Request.ItemsChoiceType7.Categories2);
            }

            changeData.ApplicationData.Items = items.ToArray();
            changeData.ApplicationData.ItemsElementName = itemsElementName.ToArray();

            SyncRequest syncRequest = TestSuiteHelper.CreateSyncChangeRequest(syncKey, collectionId, changeData);
            SyncStore result = this.EMAILAdapter.Sync(syncRequest);
            Site.Assert.AreEqual<byte>(
                1,
                result.CollectionStatus,
                "The server returns a Status 1 in the Sync command response indicate sync command success.");

            return result;
        }