/// <summary>
        /// Create a Request.Categories instance.
        /// </summary>
        /// <param name="calendarCategory">Specifies a category that is assigned to the calendar item or exception item.</param>
        /// <returns>The created Request.Categories instance.</returns>
        internal static Request.Categories CreateCalendarCategories(string[] calendarCategory)
        {
            Request.Categories calendarCategories = new Request.Categories();

            if (calendarCategory != null)
            {
                calendarCategories.Category = calendarCategory;
            }

            return(calendarCategories);
        }
        /// <summary>
        /// Create an instance of SyncCollectionChange
        /// </summary>
        /// <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 list of categories</param>
        /// <returns>An instance of SyncCollectionChange</returns>
        internal static Request.SyncCollectionChange CreateSyncChangeData(bool read, string serverId, Request.Flag flag, Collection<object> 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>();
            items.Add(read);
            itemsElementName.Add(Request.ItemsChoiceType7.Read);

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

            if (null != categories)
            {
                Request.Categories mailCategories = new Request.Categories();
                List<string> category = new List<string>();
                foreach (object categoryObject in categories)
                {
                    category.Add(categoryObject.ToString());
                }

                mailCategories.Category = category.ToArray();
                items.Add(mailCategories);
                itemsElementName.Add(Request.ItemsChoiceType7.Categories2);
            }

            changeData.ApplicationData.Items = items.ToArray();
            changeData.ApplicationData.ItemsElementName = itemsElementName.ToArray();
            return changeData;
        }
        /// <summary>
        /// Create a Request.Categories instance.
        /// </summary>
        /// <param name="calendarCategory">Specifies a category that is assigned to the calendar item or exception item.</param>
        /// <returns>The created Request.Categories instance.</returns>
        internal static Request.Categories CreateCalendarCategories(string[] calendarCategory)
        {
            Request.Categories calendarCategories = new Request.Categories();

            if (calendarCategory != null)
            {
                calendarCategories.Category = calendarCategory;
            }

            return calendarCategories;
        }
Пример #4
0
        public void MSASCMD_S19_TC27_Sync_Change()
        {
            Site.Assume.AreEqual<string>("Base64", Common.GetConfigurationPropertyValue("HeaderEncodingType", this.Site), "The device ID should be same across all requests, when the HeaderEncodingType is PlainText.");
            CMDAdapter.ChangeDeviceID(Common.GetConfigurationPropertyValue("DeviceID", this.Site));
            this.Sync(TestSuiteBase.CreateEmptySyncRequest(this.User1Information.ContactsCollectionId));

            #region Add a new contact with Sync operation.
            string contactFileAS = Common.GenerateResourceName(Site, "FileAS");
            Request.SyncCollectionAdd addData = this.CreateAddContactCommand("FirstName", "MiddleName", "LastName", contactFileAS, null);

            SyncRequest syncRequest = TestSuiteBase.CreateSyncAddRequest(this.LastSyncKey, this.User1Information.ContactsCollectionId, addData);
            SyncResponse syncResponse = this.Sync(syncRequest, false);
            Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");
            Response.SyncCollectionsCollectionResponses collectionResponse = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Responses) as Response.SyncCollectionsCollectionResponses;
            Site.Assert.IsNotNull(collectionResponse, "The responses element should exist in the Sync response.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5255
            Site.CaptureRequirementIfIsNotNull(
                collectionResponse.Add,
                5255,
                @"[In Responses] Element Responses in Sync command response (section 2.2.2.19), the child elements is Add (section 2.2.3.7.2)[, Fetch (section 2.2.3.63.2) ](If the operation succeeded.)");

            Site.Assert.AreEqual<int>(1, int.Parse(collectionResponse.Add[0].Status), "The new contact should be added correctly.");
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.ContactsCollectionId, contactFileAS);
            this.FolderSync();
            #endregion

            #region Change DeviceID and synchronize the changes in the Contacts folder.
            string syncKey = this.LastSyncKey;
            CMDAdapter.ChangeDeviceID("Device2");
            this.RecordDeviceInfoChanged();

            this.GetInitialSyncResponse(this.User1Information.ContactsCollectionId);
            syncRequest.RequestData.Collections[0].SyncKey = this.LastSyncKey;
            syncResponse = this.Sync(syncRequest);
            Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");
            string serverId = TestSuiteBase.FindServerId(syncResponse, "FileAs", contactFileAS);
            Site.Assert.IsNotNull(serverId, "The added contact should be synchronized down to the current device.");
            #endregion

            #region Change the added Contact information and then synchronize the change to the server.
            string updatedContactFileAS = Common.GenerateResourceName(Site, "UpdatedFileAS");
            Request.SyncCollectionChange appDataChange = CreateChangedContact(serverId, new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.FileAs }, new object[] { updatedContactFileAS });
            syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User1Information.ContactsCollectionId, appDataChange);
            syncResponse = this.Sync(syncRequest);
            Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The status code of Sync change operation should be 1.");
            #endregion

            #region Restore DeviceID and synchronize the changes in the Contacts folder.
            
            CMDAdapter.ChangeDeviceID(Common.GetConfigurationPropertyValue("DeviceID", this.Site));

            syncRequest = TestSuiteBase.CreateEmptySyncRequest(this.User1Information.ContactsCollectionId);
            syncRequest.RequestData.Collections[0].SyncKey = syncKey;
            syncRequest.RequestData.Collections[0].GetChanges = true;
            syncRequest.RequestData.Collections[0].GetChangesSpecified = true;
            syncResponse = this.Sync(syncRequest);
            Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The Sync command should be conducted successfully.");
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.ContactsCollectionId, updatedContactFileAS);

            Response.SyncCollectionsCollectionCommands syncCollectionCommands = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Commands) as Response.SyncCollectionsCollectionCommands;
            Site.Assert.IsNotNull(syncCollectionCommands, "The commands element should exist in the Sync response.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R3119
            Site.CaptureRequirementIfIsNotNull(
                syncCollectionCommands.Change,
                3119,
                @"[In GetChanges] If there have been changes since the last synchronization, the server response includes a Commands element (section 2.2.3.32) that contains additions, deletions, and changes.");

            Site.Assert.IsTrue(((Response.SyncCollections)syncResponse.ResponseData.Item).Collection.Length >= 1, "The length of Collections element should not less than 1. The actual value is {0}.", ((Response.SyncCollections)syncResponse.ResponseData.Item).Collection.Length);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4602
            // If the Assert statement above is passed, the requirement is captured.
            Site.CaptureRequirement(
                4602,
                @"[In SyncKey(Sync)] If the synchronization is successful, the server responds by sending all objects in the collection.");

            List<string> elements = new List<string>
            {
                Request.ItemsChoiceType4.FirstName.ToString(),
                Request.ItemsChoiceType4.MiddleName.ToString(),
                Request.ItemsChoiceType4.LastName.ToString()
            };

            Response.SyncCollectionsCollectionCommands commands = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Commands) as Response.SyncCollectionsCollectionCommands;
            Site.Assert.IsNotNull(commands, "The Commands element should not be null.");
            Site.Assert.IsNotNull(commands.Change, "The Change element should not be null.");
            Site.Assert.IsTrue(commands.Change.Length > 0, "The Change element should have one sub-element at least.");
            Site.Assert.IsNotNull(commands.Change[0].ApplicationData, "The ApplicationData element of the first Change element should not be null.");
            Site.Assert.IsNotNull(commands.Change[0].ApplicationData.ItemsElementName, "The ItemsElementName element of the ApplicationData element of the first Change element should not be null.");
            Site.Assert.IsTrue(commands.Change[0].ApplicationData.ItemsElementName.Length > 0, "The ItemsElementName element of the ApplicationData element of the first Change element should have one sub-element at least.");

            bool isVerifyR879 = false;
            foreach (Response.ItemsChoiceType7 itemElementName in commands.Change[0].ApplicationData.ItemsElementName)
            {
                if (elements.Contains(itemElementName.ToString()))
                {
                    isVerifyR879 = true;
                    break;
                }
            }

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R879
            Site.CaptureRequirementIfIsFalse(
                isVerifyR879,
                879,
                @"[In Change] In all other cases, if an in-schema property is not specified in a change request, the property is actively deleted from the item on the server.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R881
            Site.CaptureRequirementIfIsFalse(
                isVerifyR879,
                881,
                @"[In Change] Otherwise [if a client dose not be aware of this [if an in-schema property is not specified in a change request, the property is actively deleted from the item on the server] when it [client] is sending Sync requests], data can be unintentionally removed.");
            #endregion

            #region Send a MIME-formatted e-mail 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);
            serverId = TestSuiteBase.FindServerId(this.CheckEmail(this.User2Information.InboxCollectionId, emailSubject, null), "Subject", emailSubject);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject);
            #endregion

            #region Call Sync command to set a flag to an email.
            string updatedEmailSubject = Common.GenerateResourceName(Site, "updatedSubject");

            DateTime startDate = DateTime.Now.AddDays(5.0);
            DateTime dueDate = startDate.AddHours(1.0);

            // Define email flag
            Request.Flag emailFlag = new Request.Flag
            {
                StartDate = startDate,
                StartDateSpecified = true,
                DueDate = dueDate,
                DueDateSpecified = true
            };

            Request.SyncCollectionChangeApplicationData applicationData = new Request.SyncCollectionChangeApplicationData
            {
                ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.Flag, Request.ItemsChoiceType7.Subject },
                Items = new object[] { emailFlag, updatedEmailSubject }
            };

            appDataChange = new Request.SyncCollectionChange { ApplicationData = applicationData, ServerId = serverId };

            syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User2Information.InboxCollectionId, appDataChange);
            syncResponse = this.Sync(syncRequest);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R875
            Site.CaptureRequirementIfAreEqual<uint>(
                1,
                Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)),
                875,
                @"[In Change] If all the other elements are sent, extra bandwidth is used, but no errors occur.");

            // Define updated email flag
            Request.Flag updatedEmailFlag = new Request.Flag
            {
                StartDate = startDate,
                StartDateSpecified = true,
                DueDate = dueDate,
                DueDateSpecified = true
            };

            applicationData = new Request.SyncCollectionChangeApplicationData
            {
                ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.Flag },
                Items = new object[] { updatedEmailFlag }
            };

            appDataChange = new Request.SyncCollectionChange { ApplicationData = applicationData, ServerId = serverId };

            syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User2Information.InboxCollectionId, appDataChange);
            syncResponse = this.Sync(syncRequest);
            Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The email should be updated successfully.");

            syncResponse = this.SyncChanges(this.User2Information.InboxCollectionId);
            Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R873
            bool isVerifyR873 = !string.IsNullOrEmpty(TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject));
            Site.CaptureRequirementIfIsTrue(
                isVerifyR873,
                873,
                @"[In Change] Certain in-schema properties remain untouched in the following three cases: If there is only an email:Flag ([MS-ASEMAIL] section 2.2.2.27) [, email:Read ([MS-ASEMAIL] section 2.2.2.47), or email:Categories ([MS-ASEMAIL] section 2.2.2.9)] change (that is, if only an email:Flag, email:Categories or email:Read element is present), all other properties will remain unchanged.");
            #endregion

            #region Send a MIME-formatted e-mail from user1 to user2.
            this.SwitchUser(this.User1Information);
            emailSubject = Common.GenerateResourceName(this.Site, "subject");
            this.SendPlainTextEmail(null, emailSubject, this.User1Information.UserName, this.User2Information.UserName, null);

            this.SwitchUser(this.User2Information);
            serverId = TestSuiteBase.FindServerId(this.CheckEmail(this.User2Information.InboxCollectionId, emailSubject, null), "Subject", emailSubject);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject);
            #endregion

            #region Call Sync command to set a Read element to an email.
            applicationData = new Request.SyncCollectionChangeApplicationData
            {
                ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.Read, Request.ItemsChoiceType7.Subject },
                Items = new object[] { true, updatedEmailSubject }
            };

            appDataChange = new Request.SyncCollectionChange { ApplicationData = applicationData, ServerId = serverId };

            syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User2Information.InboxCollectionId, appDataChange);
            syncResponse = this.Sync(syncRequest);
            Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The email should be updated successfully.");

            applicationData = new Request.SyncCollectionChangeApplicationData
            {
                ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.Read },
                Items = new object[] { true }
            };

            appDataChange = new Request.SyncCollectionChange { ApplicationData = applicationData, ServerId = serverId };

            syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User2Information.InboxCollectionId, appDataChange);
            syncResponse = this.Sync(syncRequest);
            Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The email should be updated successfully.");

            syncResponse = this.SyncChanges(this.User2Information.InboxCollectionId);
            Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5825
            bool isVerifyR5825 = !string.IsNullOrEmpty(TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject));
            Site.CaptureRequirementIfIsTrue(
                isVerifyR5825,
                5825,
                @"[In Change] Certain in-schema properties remain untouched in the following three cases: If there is only an [email:Flag ([MS-ASEMAIL] section 2.2.2.27),] email:Read ([MS-ASEMAIL] section 2.2.2.47) [, or email:Categories ([MS-ASEMAIL] section 2.2.2.9)] change (that is, if only an email:Flag, email:Categories or email:Read element is present), all other properties will remain unchanged.");
            #endregion

            #region Send a MIME-formatted e-mail from user1 to user2.
            this.SwitchUser(this.User1Information);
            emailSubject = Common.GenerateResourceName(this.Site, "subject");
            this.SendPlainTextEmail(null, emailSubject, this.User1Information.UserName, this.User2Information.UserName, null);

            this.SwitchUser(this.User2Information);
            serverId = TestSuiteBase.FindServerId(this.CheckEmail(this.User2Information.InboxCollectionId, emailSubject, null), "Subject", emailSubject);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject);
            #endregion

            #region Call Sync command to set a Categories element to an email.
            Request.Categories categories = new Request.Categories { Category = new string[] { "company" } };

            applicationData = new Request.SyncCollectionChangeApplicationData
            {
                ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.Categories, Request.ItemsChoiceType7.Subject },
                Items = new object[] { categories, updatedEmailSubject }
            };

            appDataChange = new Request.SyncCollectionChange { ApplicationData = applicationData, ServerId = serverId };

            syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User2Information.InboxCollectionId, appDataChange);
            syncResponse = this.Sync(syncRequest);
            Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The email should be updated successfully.");

            applicationData = new Request.SyncCollectionChangeApplicationData
            {
                ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.Categories },
                Items = new object[] { categories }
            };

            appDataChange = new Request.SyncCollectionChange { ApplicationData = applicationData, ServerId = serverId };

            syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User2Information.InboxCollectionId, appDataChange);
            syncResponse = this.Sync(syncRequest);
            Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The email should be updated successfully.");

            syncResponse = this.SyncChanges(this.User2Information.InboxCollectionId);
            Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5826
            bool isVerifyR5826 = !string.IsNullOrEmpty(TestSuiteBase.FindServerId(syncResponse, "Subject", emailSubject));
            Site.CaptureRequirementIfIsTrue(
                isVerifyR5826,
                5826,
                @"[In Change] Certain in-schema properties remain untouched in the following three cases: If there is only [an email:Flag ([MS-ASEMAIL] section 2.2.2.27), email:Read ([MS-ASEMAIL] section 2.2.2.47), or] email:Categories ([MS-ASEMAIL] section 2.2.2.9) change (that is, if only an email:Flag, email:Categories or email:Read element is present), all other properties will remain unchanged.");
            #endregion

            #region Call Sync Add operation to add a new contact.
            this.SwitchUser(this.User1Information);
            this.Sync(TestSuiteBase.CreateEmptySyncRequest(this.User1Information.ContactsCollectionId));

            string contactFileAs = Common.GenerateResourceName(Site, "FileAS");

            addData.ClientId = TestSuiteBase.ClientId;
            addData.ApplicationData = new Request.SyncCollectionAddApplicationData
            {
                ItemsElementName =
                    new Request.ItemsChoiceType8[]
                    {
                        Request.ItemsChoiceType8.FileAs, Request.ItemsChoiceType8.FirstName,
                        Request.ItemsChoiceType8.MiddleName, Request.ItemsChoiceType8.LastName,
                        Request.ItemsChoiceType8.Picture
                    },
                Items =
                    new object[]
                    {
                        contactFileAs, "FirstName", "MiddleName", "LastName",
                        Convert.ToBase64String(File.ReadAllBytes("number1.jpg"))
                    }
            };

            if ("12.1" != Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site))
            {
                addData.Class = "Contacts";
            }

            syncRequest = TestSuiteBase.CreateSyncAddRequest(this.LastSyncKey, this.User1Information.ContactsCollectionId, addData);
            syncResponse = this.Sync(syncRequest, false);

            collectionResponse = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Responses) as Response.SyncCollectionsCollectionResponses;
            Site.Assert.IsNotNull(collectionResponse, "The responses element should exist in the Sync response.");
            Site.Assert.AreEqual<int>(1, int.Parse(collectionResponse.Add[0].Status), "The new contact should be added successfully.");
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.ContactsCollectionId, contactFileAs);

            syncResponse = this.SyncChanges(this.User1Information.ContactsCollectionId);
            Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");
            serverId = TestSuiteBase.FindServerId(syncResponse, "FileAs", contactFileAs);
            Site.Assert.IsNotNull(serverId, "The added contact should be synchronized down to the current device.");

            Response.SyncCollectionsCollectionCommandsAddApplicationData responseApplicationData = TestSuiteBase.GetAddApplicationData(syncResponse, Response.ItemsChoiceType8.FileAs, contactFileAS);
            Site.Assert.IsNotNull(responseApplicationData, "The ApplicationData of the calendar should not be null.");

            Response.Body body = null;
            for (int i = 0; i < responseApplicationData.ItemsElementName.Length; i++)
            {
                if (responseApplicationData.ItemsElementName[i] == Response.ItemsChoiceType8.Body)
                {
                    body = responseApplicationData.Items[i] as Response.Body;
                    break;
                }
            }

            Site.Assert.IsNotNull(body, "The Body element should be in the ApplicationData of the contact item.");
            string originalPicture = (string)TestSuiteBase.GetElementValueFromSyncResponse(syncResponse, serverId, Response.ItemsChoiceType8.Picture);
            Site.Assert.IsNotNull(originalPicture, "The picture of the contact should exist.");
            #endregion

            #region Call Sync change operation to update the FileAs element of the contact.
            string updatedContactFileAs = Common.GenerateResourceName(Site, "updatedContactFileAs");

            Request.SyncCollectionChangeApplicationData changeApplicationData = new Request.SyncCollectionChangeApplicationData
            {
                ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.FileAs },
                Items = new object[] { updatedContactFileAs }
            };

            appDataChange = new Request.SyncCollectionChange
            {
                ApplicationData = changeApplicationData,
                ServerId = serverId
            };

            syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User1Information.ContactsCollectionId, appDataChange);
            syncResponse = this.Sync(syncRequest);
            Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The FileAs of the contact should be updated successfully.");
            TestSuiteBase.RemoveRecordCaseRelativeItems(this.User1Information, this.User1Information.ContactsCollectionId, contactFileAs);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.ContactsCollectionId, updatedContactFileAs);

            syncResponse = this.SyncChanges(this.User1Information.ContactsCollectionId);
            Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");

            responseApplicationData = TestSuiteBase.GetAddApplicationData(syncResponse, Response.ItemsChoiceType8.FileAs, updatedContactFileAs);
            Site.Assert.IsNotNull(responseApplicationData, "The ApplicationData of the updated contact should not be null.");

            Response.Body currentBody = null;
            for (int i = 0; i < responseApplicationData.ItemsElementName.Length; i++)
            {
                if (responseApplicationData.ItemsElementName[i] == Response.ItemsChoiceType8.Body)
                {
                    currentBody = responseApplicationData.Items[i] as Response.Body;
                    break;
                }
            }

            Site.Assert.IsNotNull(currentBody, "The Body element should be in the ApplicationData of the updated contact item.");
            string currentPicture = (string)TestSuiteBase.GetElementValueFromSyncResponse(syncResponse, serverId, Response.ItemsChoiceType8.Picture);
            Site.Assert.IsNotNull(currentPicture, "The picture of the updated contact should exist.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R878
            bool isVerifyR878 = body.Type == currentBody.Type && body.EstimatedDataSize == currentBody.EstimatedDataSize && originalPicture == currentPicture;
            Site.CaptureRequirementIfIsTrue(
                isVerifyR878,
                878,
                @"[In Change] [Certain in-schema properties remain untouched in the following three cases:] If the airsyncbase:Body, airsyncbase:Data, or contacts:Picture elements are not present, the corresponding properties will remain unchanged.");
            #endregion
        }