コード例 #1
0
        /// <summary>
        /// Call sync command to update properties of an existing calendar item.
        /// </summary>
        /// <param name="serverId">Server Id of the calendar item.</param>
        /// <param name="collectionId">Collection Id of the folder that calendar item is contained in.</param>
        /// <param name="syncKey">Sync key value.</param>
        /// <param name="items">The dictionary store calendar item's element name and element value, which will be changed.</param>
        /// <returns>Return Sync Change response.</returns>
        public SyncStore UpdateCalendarProperty(string serverId, string collectionId, string syncKey, Dictionary <Request.ItemsChoiceType7, object> items)
        {
            Request.SyncCollectionChangeApplicationData syncChangeData = new Request.SyncCollectionChangeApplicationData
            {
                ItemsElementName = items.Keys.ToArray <Request.ItemsChoiceType7>(),
                Items            = items.Values.ToArray <object>()
            };

            Request.SyncCollectionChange syncChange = new Request.SyncCollectionChange
            {
                ApplicationData = syncChangeData,
                ServerId        = serverId
            };

            SyncRequest syncChangeRequest = new SyncRequest
            {
                RequestData = new Request.Sync {
                    Collections = new Request.SyncCollection[1]
                }
            };

            syncChangeRequest.RequestData.Collections[0] = new Request.SyncCollection
            {
                Commands     = new object[] { syncChange },
                SyncKey      = syncKey,
                CollectionId = collectionId
            };

            SyncStore syncChanageResponse = this.CALAdapter.Sync(syncChangeRequest);

            return(syncChanageResponse);
        }
コード例 #2
0
        /// <summary>
        /// Call Sync command to change a task.
        /// </summary>
        /// <param name="syncKey">The sync key.</param>
        /// <param name="serverId">The server Id of the task.</param>
        /// <param name="changedElements">The changed elements of the task.</param>
        /// <returns>Return the sync change result.</returns>
        protected SyncStore SyncChangeTask(string syncKey, string serverId, Dictionary <Request.ItemsChoiceType7, object> changedElements)
        {
            Request.SyncCollectionChange change = new Request.SyncCollectionChange
            {
                ServerId        = serverId,
                ApplicationData = new Request.SyncCollectionChangeApplicationData
                {
                    Items            = changedElements.Values.ToArray <object>(),
                    ItemsElementName = changedElements.Keys.ToArray <Request.ItemsChoiceType7>()
                }
            };

            SyncRequest syncRequest = new SyncRequest
            {
                RequestData = new Request.Sync {
                    Collections = new Request.SyncCollection[1]
                }
            };

            syncRequest.RequestData.Collections[0] = new Request.SyncCollection
            {
                Commands     = new object[] { change },
                SyncKey      = syncKey,
                CollectionId = this.UserInformation.TasksCollectionId
            };
            SyncStore syncResponse = this.TASKAdapter.Sync(syncRequest);

            return(syncResponse);
        }
コード例 #3
0
        /// <summary>
        /// Update email with more data
        /// </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 list of categories</param>
        /// <param name="additionalElement">Additional flag element</param>
        /// <param name="insertTag">Additional element will insert before this tag</param>
        /// <returns>Return update email result</returns>
        protected SendStringResponse UpdateEmailWithMoreData(string collectionId, string syncKey, bool read, string serverId, Request.Flag flag, Collection <object> categories, string additionalElement, string insertTag)
        {
            // Create normal sync request
            Request.SyncCollectionChange changeData = TestSuiteHelper.CreateSyncChangeData(read, serverId, flag, categories);
            SyncRequest syncRequest = TestSuiteHelper.CreateSyncChangeRequest(syncKey, collectionId, changeData);

            // Calls Sync command to update email with invalid sync request
            SendStringResponse result = this.EMAILAdapter.InvalidSync(syncRequest, additionalElement, insertTag);

            return(result);
        }
コード例 #4
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);
        }
コード例 #5
0
        /// <summary>
        /// Update email with invalid data
        /// </summary>
        /// <param name="invalidElement">invalid element send to server</param>
        /// <returns>Update results status code</returns>
        private string UpdateVoiceEmailWithInvalidData(string invalidElement)
        {
            // Switch to user2 mailbox
            this.SwitchUser(this.User2Information, true);

            // Sync changes
            SyncStore initSyncResult   = this.InitializeSync(this.User2Information.InboxCollectionId);
            SyncStore syncChangeResult = this.SyncChanges(initSyncResult.SyncKey, this.User2Information.InboxCollectionId, null);
            string    syncKey          = syncChangeResult.SyncKey;
            string    serverId         = this.User2Information.InboxCollectionId;

            // Create normal Sync change request
            Request.SyncCollectionChange changeData = TestSuiteHelper.CreateSyncChangeData(true, serverId, null, null);
            SyncRequest syncRequest = TestSuiteHelper.CreateSyncChangeRequest(syncKey, this.User2Information.InboxCollectionId, changeData);

            // Calls Sync command to update email with invalid sync request
            string             insertTag = "</ApplicationData>";
            SendStringResponse result    = this.EMAILAdapter.InvalidSync(syncRequest, invalidElement, insertTag);

            // Get status code
            return(TestSuiteHelper.GetStatusCode(result.ResponseDataXML));
        }
コード例 #6
0
        /// <summary>
        /// Call Sync command to change a note
        /// </summary>
        /// <param name="syncKey">The sync key</param>
        /// <param name="serverId">The server Id of the note</param>
        /// <param name="changedElements">The changed elements of the note</param>
        /// <returns>Return the sync change result</returns>
        protected SyncStore SyncChange(string syncKey, string serverId, Dictionary <Request.ItemsChoiceType7, object> changedElements)
        {
            Request.SyncCollectionChange change = new Request.SyncCollectionChange
            {
                ServerId        = serverId,
                ApplicationData = new Request.SyncCollectionChangeApplicationData
                {
                    ItemsElementName = new Request.ItemsChoiceType7[changedElements.Count],
                    Items            = new object[changedElements.Count]
                }
            };

            changedElements.Keys.CopyTo(change.ApplicationData.ItemsElementName, 0);
            changedElements.Values.CopyTo(change.ApplicationData.Items, 0);

            List <object> changeData = new List <object> {
                change
            };
            SyncRequest syncRequest = TestSuiteHelper.CreateSyncRequest(syncKey, this.UserInformation.NotesCollectionId, changeData);

            return(this.NOTEAdapter.Sync(syncRequest, false));
        }
コード例 #7
0
        /// <summary>
        /// Call Sync command to change the status of the emails in Inbox folder.
        /// </summary>
        /// <param name="syncKey">The latest SyncKey.</param>
        /// <param name="serverIds">The collection of ServerIds.</param>
        /// <param name="collectionId">The folder collectionId which needs to be sychronized.</param>
        /// <param name="read">Read element of the item.</param>
        /// <param name="status">Flag status of the item.</param>
        /// <returns>The SyncStore instance returned from Sync command.</returns>
        protected SyncStore SyncChange(string syncKey, Collection <string> serverIds, string collectionId, bool?read, string status)
        {
            List <Request.SyncCollectionChange> changes = new List <Request.SyncCollectionChange>();

            foreach (string serverId in serverIds)
            {
                Request.SyncCollectionChange change = new Request.SyncCollectionChange
                {
                    ServerId        = serverId,
                    ApplicationData = new Request.SyncCollectionChangeApplicationData()
                };

                List <object> changeItems = new List <object>();
                List <Request.ItemsChoiceType7> changeItemsElementName = new List <Request.ItemsChoiceType7>();

                if (read != null)
                {
                    changeItems.Add(read);
                    changeItemsElementName.Add(Request.ItemsChoiceType7.Read);
                }

                if (!string.IsNullOrEmpty(status))
                {
                    Request.Flag flag = new Request.Flag();
                    if (status == "1")
                    {
                        // The Complete Time format is yyyy-MM-ddThh:mm:ss.fffZ.
                        flag.CompleteTime           = System.DateTime.Now.ToUniversalTime();
                        flag.CompleteTimeSpecified  = true;
                        flag.DateCompleted          = System.DateTime.Now.ToUniversalTime();
                        flag.DateCompletedSpecified = true;
                    }

                    flag.Status   = status;
                    flag.FlagType = "Flag for follow up";

                    changeItems.Add(flag);
                    changeItemsElementName.Add(Request.ItemsChoiceType7.Flag);
                }

                change.ApplicationData.Items            = changeItems.ToArray();
                change.ApplicationData.ItemsElementName = changeItemsElementName.ToArray();

                changes.Add(change);
            }

            Request.SyncCollection collection = new Request.SyncCollection
            {
                CollectionId = collectionId,
                SyncKey      = syncKey,
                Commands     = changes.ToArray()
            };

            SyncRequest syncRequest = Common.CreateSyncRequest(new Request.SyncCollection[] { collection });
            SyncStore   syncStore   = this.CONAdapter.Sync(syncRequest);

            // Verify Sync command response.
            Site.Assert.AreEqual <byte>(
                1,
                syncStore.CollectionStatus,
                "If the Sync command executes successfully, the Status in response should be 1.");

            this.LatestSyncKey = syncStore.SyncKey;

            return(syncStore);
        }
コード例 #8
0
        public void MSASCAL_S01_TC33_DeletePropertyOfException()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(2242, this.Site), "Exchange 2007 does not support deleting elements of a recurring calendar item in an Exception element.");
            Site.Assume.AreNotEqual<string>("16.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The recurring calendar item cannot be created when protocol version is set to 16.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");

            #region Call Sync command to add a calendar to the server, and sync calendars from the server.

            Dictionary<Request.ItemsChoiceType8, object> calendarItem = new Dictionary<Request.ItemsChoiceType8, object>();

            DateTime exceptionStartTime = this.StartTime.AddDays(3);

            // Set Calendar StartTime, EndTime elements
            calendarItem.Add(Request.ItemsChoiceType8.StartTime, this.StartTime.ToString("yyyyMMddTHHmmssZ"));
            calendarItem.Add(Request.ItemsChoiceType8.EndTime, this.EndTime.ToString("yyyyMMddTHHmmssZ"));

            // Set Calendar Recurrence element including Occurrence sub-element
            byte recurrenceType = byte.Parse("0");
            Request.Recurrence recurrence = this.CreateCalendarRecurrence(recurrenceType, 6, 1);

            // Set Calendar Exceptions element
            Request.Exceptions exceptions = new Request.Exceptions { Exception = new Request.ExceptionsException[] { } };
            List<Request.ExceptionsException> exceptionList = new List<Request.ExceptionsException>();

            // Set ExceptionStartTime element in exception
            Request.ExceptionsException exception = TestSuiteHelper.CreateExceptionRequired(exceptionStartTime.ToString("yyyyMMddTHHmmssZ"));

            exception.Subject = "Calendar Exception";
            exception.Location = "Room 666";
            exceptionList.Add(exception);
            exceptions.Exception = exceptionList.ToArray();

            calendarItem.Add(Request.ItemsChoiceType8.Recurrence, recurrence);
            calendarItem.Add(Request.ItemsChoiceType8.Exceptions, exceptions);
            calendarItem.Add(Request.ItemsChoiceType8.Location, this.Location);

            string emailAddress = Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain);
            calendarItem.Add(Request.ItemsChoiceType8.Attendees, TestSuiteHelper.CreateAttendeesRequired(new string[] { emailAddress }, new string[] { this.User2Information.UserName }));
            calendarItem.Add(Request.ItemsChoiceType8.MeetingStatus, (byte)1);
            if (!this.IsActiveSyncProtocolVersion121)
            {
                calendarItem.Add(Request.ItemsChoiceType8.ResponseRequested, true);
                calendarItem.Add(Request.ItemsChoiceType8.DisallowNewTimeProposal, true);
            }

            string subject = Common.GenerateResourceName(Site, "subject");
            calendarItem.Add(Request.ItemsChoiceType8.Subject, subject);

            this.AddSyncCalendar(calendarItem);

            SyncItem calendar = this.GetChangeItem(this.User1Information.CalendarCollectionId, subject);

            Site.Assert.IsNotNull(calendar.Calendar, "The calendar with subject {0} should exist in server.", subject);
            this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.CalendarCollectionId, subject);
            #endregion

            #region Call Sync command to delete the Location property of the exception to change the calendar, and sync calendars from the server.

            SyncStore syncResponse1 = this.InitializeSync(this.User1Information.CalendarCollectionId, null);
            SyncRequest syncRequest = TestSuiteHelper.CreateSyncRequest(this.User1Information.CalendarCollectionId, syncResponse1.SyncKey, true);
            SyncStore syncResponse2 = this.CALAdapter.Sync(syncRequest);

            // Delete Location property of the Exception
            Dictionary<Request.ItemsChoiceType7, object> changeItem = new Dictionary<Request.ItemsChoiceType7, object>();
            exception.Location = null;
            changeItem.Add(Request.ItemsChoiceType7.Exceptions, exceptions);
            changeItem.Add(Request.ItemsChoiceType7.Recurrence, recurrence);
            changeItem.Add(Request.ItemsChoiceType7.Subject, subject);
            Request.SyncCollectionChangeApplicationData syncChangeData = new Request.SyncCollectionChangeApplicationData
            {
                ItemsElementName = changeItem.Keys.ToArray<Request.ItemsChoiceType7>(),
                Items = changeItem.Values.ToArray<object>()
            };

            Request.SyncCollectionChange syncChange = new Request.SyncCollectionChange
            {
                ApplicationData = syncChangeData,
                ServerId = calendar.ServerId
            };

            SyncRequest syncChangeRequest = new SyncRequest
            {
                RequestData = new Request.Sync { Collections = new Request.SyncCollection[1] }
            };

            syncChangeRequest.RequestData.Collections[0] = new Request.SyncCollection
            {
                Commands = new object[] { syncChange },
                SyncKey = syncResponse2.SyncKey,
                CollectionId = this.User1Information.CalendarCollectionId
            };

            // If an element in a recurring calendar item has been deleted in an Exception element, sends an empty tag
            // for this element to remove the inherited value from the server.
            string syncXmlRequest = syncChangeRequest.GetRequestDataSerializedXML();
            string changedSyncXmlRequest = syncXmlRequest.Insert(syncXmlRequest.IndexOf("</Exception>", StringComparison.CurrentCulture), "<Location />");
            SendStringResponse result = this.CALAdapter.SendStringRequest(changedSyncXmlRequest);

            #endregion

            #region Call Sync command to get the changed calendar.

            SyncStore initializeSyncResponse = this.InitializeSync(this.User1Information.CalendarCollectionId, null);
            syncRequest = TestSuiteHelper.CreateSyncRequest(this.User1Information.CalendarCollectionId, initializeSyncResponse.SyncKey, true);
            result = this.CALAdapter.SendStringRequest(syncRequest.GetRequestDataSerializedXML());

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(result.ResponseDataXML);
            XmlNamespaceManager nameSpaceManager = new XmlNamespaceManager(doc.NameTable);
            nameSpaceManager.AddNamespace("e", "AirSync");
            XmlNodeList nodes = doc.SelectNodes("//e:Collections/e:Collection/e:Commands/e:Add/e:ApplicationData", nameSpaceManager);
            bool isEmptyLocationContained = false;
            foreach (XmlNode node in nodes)
            {
                bool isFound = false;
                XmlNodeList subNodes = node.ChildNodes;
                foreach (XmlNode subNode in subNodes)
                {
                    if (subNode.Name.Equals("Subject") && subNode.InnerText != null && subNode.InnerText.Equals(subject))
                    {
                        isFound = true;
                    }
                    if (isFound && subNode.Name.Equals("Exceptions"))
                    {
                        isEmptyLocationContained = subNode.InnerXml.Contains("<Location />");
                        break;
                    }
                }
                if (isEmptyLocationContained)
                {
                    break;
                }
            }

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

            // Verify MS-ASCAL requirement: MS-ASCAL_R2242
            Site.CaptureRequirementIfIsTrue(
                isEmptyLocationContained,
                2242,
                @"[In Appendix B: Product Behavior]  If an element in a recurring calendar item has been deleted in an Exception element (section 2.2.2.19), the client sends an empty tag for this element to remove the inherited value from the implementation. (Exchange 2010 and above follow this behavior.)");

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

            // Verify MS-ASCAL requirement: MS-ASCAL_R539
            Site.CaptureRequirementIfIsTrue(
                isEmptyLocationContained,
                539,
                @"[In Sync Command Response] If one or more properties of an exception for recurring calendar item (that is, any child elements of the Exception element (section 2.2.2.19)) have been deleted, the server MUST transmit an empty element in the Sync command response to indicate that this property is not inherited from the recurrence.");

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

            // Verify MS-ASCAL requirement: MS-ASCAL_R543
            Site.CaptureRequirementIfIsTrue(
                isEmptyLocationContained,
                543,
                @"[In Indicating Deleted Elements in Exceptions] If an element of a recurring calendar item has been deleted in an Exception element (section 2.2.2.19), the server MUST send an empty tag for this element in the Sync command response ([MS-ASCMD] section 2.2.2.19).");

            #endregion
        }
コード例 #9
0
        public void MSASEMAIL_S01_TC17_IncludedConversationIdInRequest()
        {
            Site.Assume.AreNotEqual<string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The email2:ConversationId element is not supported when the ActiveSyncProtocolVersion is 12.1.");

            #region Call SendMail command to send an email.
            string emailSubject = Common.GenerateResourceName(Site, "subject");
            this.SendPlaintextEmail(emailSubject, string.Empty, string.Empty);
            #endregion

            #region Call Sync command with Change element and include "ConversationId" element to update the email item.
            SyncStore getEmailItem = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);
            Sync item = TestSuiteHelper.GetSyncAddItem(getEmailItem, emailSubject);

            Request.SyncCollectionChange changeData = new Request.SyncCollectionChange
            {
                ServerId = item.ServerId,
                ApplicationData = new Request.SyncCollectionChangeApplicationData()
            };

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

            items.Add(true);
            itemsElementName.Add(Request.ItemsChoiceType7.Read);

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

            SyncRequest syncRequest = TestSuiteHelper.CreateSyncChangeRequest(getEmailItem.SyncKey, this.User2Information.InboxCollectionId, changeData);
            SendStringResponse response = this.EMAILAdapter.InvalidSync(syncRequest, "<ConversationId xmlns=\"Email2\"><![CDATA[6E83QrDB2UWpEw+EHaJC3A==]]></ConversationId>", "<Read xmlns=\"Email\">");
            #endregion

            #region Verify requirement
            // If the status value in sync change response is 6, then requirement MS-ASEMAIL_R347 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R347");

            // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R347
            Site.CaptureRequirementIfAreEqual<string>(
                "6",
                TestSuiteHelper.GetStatusCode(response.ResponseDataXML),
                347,
                @"[In ConversationId] The server returns a Status element value of 6 in the Sync command response ([MS-ASCMD] section 2.2.2.20) when the email2:ConversationId element is included within a Change element ([MS-ASCMD] section 2.2.3.24) in a Sync command request.");
            #endregion
        }
コード例 #10
0
        /// <summary>
        /// Call Sync command to change a task.
        /// </summary>
        /// <param name="syncKey">The sync key.</param>
        /// <param name="serverId">The server Id of the task.</param>
        /// <param name="changedElements">The changed elements of the task.</param>
        /// <returns>Return the sync change result.</returns>
        protected SyncStore SyncChangeTask(string syncKey, string serverId, Dictionary<Request.ItemsChoiceType7, object> changedElements)
        {
            Request.SyncCollectionChange change = new Request.SyncCollectionChange
            {
                ServerId = serverId,
                ApplicationData = new Request.SyncCollectionChangeApplicationData
                {
                    Items = changedElements.Values.ToArray<object>(),
                    ItemsElementName = changedElements.Keys.ToArray<Request.ItemsChoiceType7>()
                }
            };

            SyncRequest syncRequest = new SyncRequest
            {
                RequestData = new Request.Sync { Collections = new Request.SyncCollection[1] }
            };
            syncRequest.RequestData.Collections[0] = new Request.SyncCollection
            {
                Commands = new object[] { change },
                SyncKey = syncKey,
                CollectionId = this.UserInformation.TasksCollectionId
            };
            SyncStore syncResponse = this.TASKAdapter.Sync(syncRequest);

            return syncResponse;
        }
コード例 #11
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;
        }
コード例 #12
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
        }
コード例 #13
0
        /// <summary>
        /// Create a Sync Change request by using the specified sync key, folder collectionId and change application data.
        /// </summary>
        /// <param name="syncKey">Specify the sync key obtained from the last Sync response.</param>
        /// <param name="collectionId">Specify the serverId of the folder to be synchronized.</param>
        /// <param name="changeData">The data used to specify the Change element for Sync command.</param>
        /// <returns>The SyncRequest instance.</returns>
        internal static SyncRequest CreateSyncChangeRequest(string syncKey, string collectionId, Request.SyncCollectionChange changeData)
        {
            Request.SyncCollection syncCollection = CreateSyncCollection(syncKey, collectionId);
            syncCollection.Commands = new object[] { changeData };

            return(Common.CreateSyncRequest(new Request.SyncCollection[] { syncCollection }));
        }
コード例 #14
0
        /// <summary>
        /// Call Sync command to change a note
        /// </summary>
        /// <param name="syncKey">The sync key</param>
        /// <param name="serverId">The server Id of the note</param>
        /// <param name="changedElements">The changed elements of the note</param>
        /// <returns>Return the sync change result</returns>
        protected SyncStore SyncChange(string syncKey, string serverId, Dictionary<Request.ItemsChoiceType7, object> changedElements)
        {
            Request.SyncCollectionChange change = new Request.SyncCollectionChange
            {
                ServerId = serverId,
                ApplicationData = new Request.SyncCollectionChangeApplicationData
                {
                    ItemsElementName = new Request.ItemsChoiceType7[changedElements.Count],
                    Items = new object[changedElements.Count]
                }
            };

            changedElements.Keys.CopyTo(change.ApplicationData.ItemsElementName, 0);
            changedElements.Values.CopyTo(change.ApplicationData.Items, 0);

            List<object> changeData = new List<object> { change };
            SyncRequest syncRequest = TestSuiteHelper.CreateSyncRequest(syncKey, this.UserInformation.NotesCollectionId, changeData);
            return this.NOTEAdapter.Sync(syncRequest, false);
        }
コード例 #15
0
        public void MSASCNTC_S01_TC02_Sync_GhostedElements_ExceptAssistantName()
        {
            #region Call Sync command with Add element to add a contact to the server
            Dictionary<Request.ItemsChoiceType8, object> contactProperties = this.SetContactProperties(null);
            this.AddContact(this.User1Information.ContactsCollectionId, contactProperties);

            this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.ContactsCollectionId, contactProperties[Request.ItemsChoiceType8.FileAs].ToString());
            #endregion

            #region Call Sync command with Supported element in initial Sync request to synchronize the contact item that added in previous step
            // Put the AssistantName into Supported element
            Request.Supported supportedElements = new Request.Supported
            {
                Items = new object[] { string.Empty },
                ItemsElementName = new Request.ItemsChoiceType[] { Request.ItemsChoiceType.AssistantName }
            };

            // Get the new added contact
            Sync newAddedItem = this.GetSyncAddResult(contactProperties[Request.ItemsChoiceType8.FileAs].ToString(), this.User1Information.ContactsCollectionId, null, supportedElements);
            #endregion

            #region Call Sync command with Change element to change the AssistantName value of the contact
            Request.SyncCollectionChange changeData = new Request.SyncCollectionChange
            {
                ApplicationData = new Request.SyncCollectionChangeApplicationData
                {
                    Items = new object[] { "EditedAssistantName" },
                    ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.AssistantName }
                },
                ServerId = newAddedItem.ServerId
            };

            this.UpdateContact(this.SyncKey, this.User1Information.ContactsCollectionId, changeData);
            #endregion

            #region Call Sync command to synchronize the changed contact on the server
            // Get the updated contact
            Sync changedItem = this.GetSyncChangeResult(contactProperties[Request.ItemsChoiceType8.FileAs].ToString(), this.User1Information.ContactsCollectionId, this.SyncKey, null);

            Site.Assert.AreEqual<string>(
                "EditedAssistantName",
                changedItem.Contact.AssistantName,
                "The value of AssistantName should be changed.");
            #endregion

            #region Verify requirements
            // If the value of the ghosted elements except the one added into Supported element in Sync change response equals the value in Sync.Add response, it means the existing value for these elements are preserved, then the ghosted elements can be verified.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R100");

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R100
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.AccountName,
                changedItem.Contact.AccountName,
                100,
                @"[In AccountName] This element[contacts2:AccountName] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R110
            Site.CaptureRequirementIfAreEqual<DateTime?>(
                newAddedItem.Contact.Anniversary,
                changedItem.Contact.Anniversary,
                110,
                @"[In Anniversary] This element[Anniversary] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R120
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.AssistantPhoneNumber,
                changedItem.Contact.AssistantPhoneNumber,
                120,
                @"[In AssistantPhoneNumber] This element[AssistantPhoneNumber] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R125
            Site.CaptureRequirementIfAreEqual<DateTime?>(
                newAddedItem.Contact.Birthday,
                changedItem.Contact.Birthday,
                125,
                @"[In Birthday] This element[Birthday] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R133
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.BusinessAddressCity,
                changedItem.Contact.BusinessAddressCity,
                133,
                @"[In BusinessAddressCity] This element[BusinessAddressCity] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R138
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.BusinessAddressCountry,
                changedItem.Contact.BusinessAddressCountry,
                138,
                @"[In BusinessAddressCountry] This element [BusinessAddressCountry]can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R700
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.BusinessAddressPostalCode,
                changedItem.Contact.BusinessAddressPostalCode,
                700,
                @"[In BusinessAddressPostalCode] This element[BusinessAddressPostalCode] can be ghosted. ");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R146
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.BusinessAddressState,
                changedItem.Contact.BusinessAddressState,
                146,
                @"[In BusinessAddressState] This element[BusinessAddressState] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R151
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.BusinessAddressStreet,
                changedItem.Contact.BusinessAddressStreet,
                151,
                @"[In BusinessAddressStreet] This element[BusinessAddressStreet] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R156
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.BusinessFaxNumber,
                changedItem.Contact.BusinessFaxNumber,
                156,
                @"[In BusinessFaxNumber] This element[BusinessFaxNumber] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R161
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.BusinessPhoneNumber,
                changedItem.Contact.BusinessPhoneNumber,
                161,
                @"[In BusinessPhoneNumber] This element[BusinessPhoneNumber] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R166
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.Business2PhoneNumber,
                changedItem.Contact.Business2PhoneNumber,
                166,
                @"[In Business2PhoneNumber] This element[Business2PhoneNumber] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R171
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.CarPhoneNumber,
                changedItem.Contact.CarPhoneNumber,
                171,
                @"[In CarPhoneNumber] This element[CarPhoneNumber] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R177
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.Categories.Category[0],
                changedItem.Contact.Categories.Category[0],
                177,
                @"[In Categories] This element[Categories] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R188
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.Children.Child[0],
                changedItem.Contact.Children.Child[0],
                188,
                @"[In Children] This element[Children] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R198
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.CompanyMainPhone,
                changedItem.Contact.CompanyMainPhone,
                198,
                @"[In CompanyMainPhone] This element[contacts2:CompanyMainPhone] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R203
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.CompanyName,
                changedItem.Contact.CompanyName,
                203,
                @"[In CompanyName] This element[CompanyName] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R208
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.CustomerId,
                changedItem.Contact.CustomerId,
                208,
                @"[In CustomerId] This element[contacts2:CustomerId] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R212
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.Department,
                changedItem.Contact.Department,
                212,
                @"[In Department] This element[Department] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R217
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.Email1Address,
                changedItem.Contact.Email1Address,
                217,
                @"[In Email1Address] This element[Email1Address] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R224
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.Email2Address,
                changedItem.Contact.Email2Address,
                224,
                @"[In Email2Address] This element[Email2Address] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R229
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.Email3Address,
                changedItem.Contact.Email3Address,
                229,
                @"[In Email3Address] This element[Email3Address] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R234
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.FileAs,
                changedItem.Contact.FileAs,
                234,
                @"[In FileAs] This element[FileAs] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R241
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.FirstName,
                changedItem.Contact.FirstName,
                241,
                @"[In FirstName] This element[FirstName] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R246
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.GovernmentId,
                changedItem.Contact.GovernmentId,
                246,
                @"[In GovernmentId] This element[contacts2:GovernmentId] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R251
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.HomeAddressCity,
                changedItem.Contact.HomeAddressCity,
                251,
                @"[In HomeAddressCity] This element[HomeAddressCity] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R256
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.HomeAddressCountry,
                changedItem.Contact.HomeAddressCountry,
                256,
                @"[In HomeAddressCountry] This element[HomeAddressCountry] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R261
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.HomeAddressPostalCode,
                changedItem.Contact.HomeAddressPostalCode,
                261,
                @"[In HomeAddressPostalCode] This element[HomeAddressPostalCode] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R266
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.HomeAddressState,
                changedItem.Contact.HomeAddressState,
                266,
                @"[In HomeAddressState] This element[HomeAddressState] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R271
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.HomeAddressStreet,
                changedItem.Contact.HomeAddressStreet,
                271,
                @"[In HomeAddressStreet] This element[HomeAddressStreet] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R276
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.HomeFaxNumber,
                changedItem.Contact.HomeFaxNumber,
                276,
                @"[In HomeFaxNumber] This element[HomeFaxNumber] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R281
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.HomePhoneNumber,
                changedItem.Contact.HomePhoneNumber,
                281,
                @"[In HomePhoneNumber] This element[HomePhoneNumber] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R286
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.Home2PhoneNumber,
                changedItem.Contact.Home2PhoneNumber,
                286,
                @"[In Home2PhoneNumber] This element[Home2PhoneNumber] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R291
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.IMAddress,
                changedItem.Contact.IMAddress,
                291,
                @"[In IMAddress] This element[contacts2:IMAddress] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R296
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.IMAddress2,
                changedItem.Contact.IMAddress2,
                296,
                @"[In IMAddress2] This element[contacts2:IMAddress2] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R301
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.IMAddress3,
                changedItem.Contact.IMAddress3,
                301,
                @"[In IMAddress3] This element[contacts2:IMAddress3] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R306
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.JobTitle,
                changedItem.Contact.JobTitle,
                306,
                @"[In JobTitle] This element[JobTitle] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R311
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.LastName,
                changedItem.Contact.LastName,
                311,
                @"[In LastName] This element[LastName] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R316
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.ManagerName,
                changedItem.Contact.ManagerName,
                316,
                @"[In ManagerName] This element[contacts2:ManagerName] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R321
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.MiddleName,
                changedItem.Contact.MiddleName,
                321,
                @"[In MiddleName] This element[MiddleName] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R326
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.MMS,
                changedItem.Contact.MMS,
                326,
                @"[In MMS] This element[contacts2:MMS] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R331
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.MobilePhoneNumber,
                changedItem.Contact.MobilePhoneNumber,
                331,
                @"[In MobilePhoneNumber] This element[MobilePhoneNumber] can be ghosted.");

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R336
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.NickName,
                changedItem.Contact.NickName,
                336,
                @"[In NickName] This element[contacts2:NickName] can be ghosted.");

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R341
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.OfficeLocation,
                changedItem.Contact.OfficeLocation,
                341,
                @"[In OfficeLocation] This element[OfficeLocation] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R346
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.OtherAddressCity,
                changedItem.Contact.OtherAddressCity,
                346,
                @"[In OtherAddressCity] This element[OtherAddressCity] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R351
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.OtherAddressCountry,
                changedItem.Contact.OtherAddressCountry,
                351,
                @"[In OtherAddressCountry] This element[OtherAddressCountry] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R356
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.OtherAddressPostalCode,
                changedItem.Contact.OtherAddressPostalCode,
                356,
                @"[In OtherAddressPostalCode] This element[OtherAddressPostalCode] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R361
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.OtherAddressState,
                changedItem.Contact.OtherAddressState,
                361,
                @"[In OtherAddressState] This element[OtherAddressState] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R366
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.OtherAddressStreet,
                changedItem.Contact.OtherAddressStreet,
                366,
                @"[In OtherAddressStreet] This element[OtherAddressStreet] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R371
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.PagerNumber,
                changedItem.Contact.PagerNumber,
                371,
                @"[In PagerNumber] This element[PagerNumber] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R388
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.RadioPhoneNumber,
                changedItem.Contact.RadioPhoneNumber,
                388,
                @"[In RadioPhoneNumber] This element[RadioPhoneNumber] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R393
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.Spouse,
                changedItem.Contact.Spouse,
                393,
                @"[In Spouse] This element[Spouse] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R398
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.Suffix,
                changedItem.Contact.Suffix,
                398,
                @"[In Suffix] This element[Suffix] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R403
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.Title,
                changedItem.Contact.Title,
                403,
                @"[In Title] This element[Title] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R408
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.WebPage,
                changedItem.Contact.WebPage,
                408,
                @"[In WebPage] This element[WebPage] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R420
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.YomiCompanyName,
                changedItem.Contact.YomiCompanyName,
                420,
                @"[In YomiCompanyName] This element[YomiCompanyName] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R425
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.YomiFirstName,
                changedItem.Contact.YomiFirstName,
                425,
                @"[In YomiFirstName] This element[YomiFirstName] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R430
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.YomiLastName,
                changedItem.Contact.YomiLastName,
                430,
                @"[In YomiLastName] This element[YomiLastName] can be ghosted.");

            // If all above requirements can be captured successfully, then requirement MS-ASCNTC_R499 can be captured directly.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R499");

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R499
            Site.CaptureRequirement(
                499,
                @"[In Omitting Ghosted Properties from a Sync Change Request] Instead of deleting these excluded properties [Ghosted elements], the server preserves their previous value.");
            #endregion
        }
コード例 #16
0
        /// <summary>
        /// Call sync command to update properties of an existing calendar item.
        /// </summary>
        /// <param name="serverId">Server Id of the calendar item.</param>
        /// <param name="collectionId">Collection Id of the folder that calendar item is contained in.</param>
        /// <param name="syncKey">Sync key value.</param>
        /// <param name="items">The dictionary store calendar item's element name and element value, which will be changed.</param>
        /// <returns>Return Sync Change response.</returns>
        public SyncStore UpdateCalendarProperty(string serverId, string collectionId, string syncKey, Dictionary<Request.ItemsChoiceType7, object> items)
        {
            Request.SyncCollectionChangeApplicationData syncChangeData = new Request.SyncCollectionChangeApplicationData
            {
                ItemsElementName = items.Keys.ToArray<Request.ItemsChoiceType7>(),
                Items = items.Values.ToArray<object>()
            };

            Request.SyncCollectionChange syncChange = new Request.SyncCollectionChange
            {
                ApplicationData = syncChangeData,
                ServerId = serverId
            };

            SyncRequest syncChangeRequest = new SyncRequest
            {
                RequestData = new Request.Sync { Collections = new Request.SyncCollection[1] }
            };

            syncChangeRequest.RequestData.Collections[0] = new Request.SyncCollection
            {
                Commands = new object[] { syncChange },
                SyncKey = syncKey,
                CollectionId = collectionId
            };

            SyncStore syncChanageResponse = this.CALAdapter.Sync(syncChangeRequest);
            return syncChanageResponse;
        }
コード例 #17
0
        /// <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;
        }
コード例 #18
0
        public void MSASAIRS_S05_TC01_Location()
        {
            Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Location element is supported when the MS-ASProtocolVersion header is set to 16.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            Site.Assume.AreNotEqual <string>("14.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Location element is supported when the MS-ASProtocolVersion header is set to 16.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            Site.Assume.AreNotEqual <string>("14.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Location element is supported when the MS-ASProtocolVersion header is set to 16.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");

            #region Call Sync command with Add element to add an appointment to the server
            Request.SyncCollectionAddApplicationData applicationData = new Request.SyncCollectionAddApplicationData();

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

            string subject = Common.GenerateResourceName(Site, "Subject");
            items.Add(subject);
            itemsElementName.Add(Request.ItemsChoiceType8.Subject);

            // MeetingStauts is set to 0, which means it is an appointment with no attendees.
            byte meetingStatus = 0;
            items.Add(meetingStatus);
            itemsElementName.Add(Request.ItemsChoiceType8.MeetingStatus);

            Request.Location location = new Request.Location();
            location.Accuracy                  = (double)1;
            location.AccuracySpecified         = true;
            location.Altitude                  = (double)55.46;
            location.AltitudeAccuracy          = (double)1;
            location.AltitudeAccuracySpecified = true;
            location.AltitudeSpecified         = true;
            location.Annotation                = "Location sample annotation";
            location.City               = "Location sample city";
            location.Country            = "Location sample country";
            location.DisplayName        = "Location sample dislay name";
            location.Latitude           = (double)11.56;
            location.LatitudeSpecified  = true;
            location.LocationUri        = "Location Uri";
            location.Longitude          = (double)1.9;
            location.LongitudeSpecified = true;
            location.PostalCode         = "Location sample postal code";
            location.State              = "Location sample state";
            location.Street             = "Location sample street";
            items.Add(location);
            itemsElementName.Add(Request.ItemsChoiceType8.Location);

            applicationData.Items            = items.ToArray();
            applicationData.ItemsElementName = itemsElementName.ToArray();
            SyncRequest syncAddRequest = TestSuiteHelper.CreateSyncAddRequest(this.GetInitialSyncKey(this.User1Information.CalendarCollectionId), this.User1Information.CalendarCollectionId, applicationData);

            DataStructures.SyncStore syncAddResponse = this.ASAIRSAdapter.Sync(syncAddRequest);
            Site.Assert.IsTrue(syncAddResponse.AddResponses[0].Status.Equals("1"), "The sync add operation should be success; It is:{0} actually", syncAddResponse.AddResponses[0].Status);

            // Add the appointment to clean up list.
            this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.CalendarCollectionId, subject);
            #endregion

            #region Call Sync command to get the new added calendar item.
            DataStructures.Sync syncItem = this.GetSyncResult(subject, this.User1Information.CalendarCollectionId, null, null, null);
            #endregion

            #region Call ItemOperations command to reterive the added calendar item.
            this.GetItemOperationsResult(this.User1Information.CalendarCollectionId, syncItem.ServerId, null, null, null, null);
            #endregion

            #region Call Sync command to remove the location of the added calender item.
            // Create empty change items list.
            List <object> changeItems = new List <object>();
            List <Request.ItemsChoiceType7> changeItemsElementName = new List <Request.ItemsChoiceType7>();

            // Create an empty location.
            location = new Request.Location();

            // Add the location field name into the change items element name list.
            changeItemsElementName.Add(Request.ItemsChoiceType7.Location);
            // Add the empty location value to the change items value list.
            changeItems.Add(location);

            // Create sync collection change.
            Request.SyncCollectionChange collectionChange = new Request.SyncCollectionChange
            {
                ServerId        = syncItem.ServerId,
                ApplicationData = new Request.SyncCollectionChangeApplicationData
                {
                    ItemsElementName = changeItemsElementName.ToArray(),
                    Items            = changeItems.ToArray()
                }
            };

            // Create change sync collection
            Request.SyncCollection collection = new Request.SyncCollection
            {
                SyncKey      = this.SyncKey,
                CollectionId = this.User1Information.CalendarCollectionId,
                Commands     = new object[] { collectionChange }
            };

            // Create change sync request.
            SyncRequest syncChangeRequest = Common.CreateSyncRequest(new Request.SyncCollection[] { collection });

            // Change the location of the added calender by Sync request.
            DataStructures.SyncStore syncChangeResponse = this.ASAIRSAdapter.Sync(syncChangeRequest);
            Site.Assert.IsTrue(syncChangeResponse.CollectionStatus.Equals(1), "The sync change operation should be success; It is:{0} actually", syncChangeResponse.CollectionStatus);

            #region Call Sync command to get the new changed calendar item that removed the location.
            syncItem = this.GetSyncResult(subject, this.User1Information.CalendarCollectionId, null, null, null);
            #endregion

            #region Call ItemOperations command to reterive the changed calendar item that removed the location.
            DataStructures.ItemOperations itemOperations = this.GetItemOperationsResult(this.User1Information.CalendarCollectionId, syncItem.ServerId, null, null, null, null);
            #endregion
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R1001013");

            // Verify MS-ASAIRS requirement: MS-ASAIRS_R1001013
            Site.CaptureRequirementIfIsNull(
                itemOperations.Calendar.Location1.DisplayName,
                1001013,
                @"[In Location] The client's request can include an empty Location element to remove the location from an item.");
            #endregion

            if (Common.IsRequirementEnabled(53, this.Site))
            {
                #region Call Search command to search the added calendar item.
                this.GetSearchResult(subject, this.User1Information.CalendarCollectionId, null, null, null);
                #endregion
            }
        }
コード例 #19
0
 /// <summary>
 /// Create a change contact request.
 /// </summary>
 /// <param name="serverId">Server id of the contact.</param>
 /// <param name="itemElementName">The name of the item element.</param>
 /// <param name="items">The value of the item element.</param>
 /// <returns>The change contact request.</returns>
 private static Request.SyncCollectionChange CreateChangedContact(string serverId, Request.ItemsChoiceType7[] itemElementName, object[] items)
 {
     Request.SyncCollectionChange appData = new Request.SyncCollectionChange
     {
         ServerId = serverId,
         ApplicationData = new Request.SyncCollectionChangeApplicationData
         {
             ItemsElementName = itemElementName,
             Items = items
         }
     };
     return appData;
 }
コード例 #20
0
        public void MSASCMD_S19_TC51_Sync_Change_Exceptions()
        {
            Site.Assume.AreNotEqual<string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Class element is not supported in a Sync command response 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>("16.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "Recurrences cannot be added in protocol version 16.0");

            this.Sync(TestSuiteBase.CreateEmptySyncRequest(this.User1Information.CalendarCollectionId));

            #region Call Sync Add operation to add a new recurrence calendar.
            string recurrenceCalendarSubject = Common.GenerateResourceName(Site, "calendarSubject");
            string location = Common.GenerateResourceName(Site, "Room");
            DateTime currentDate = DateTime.Now.AddDays(1);
            DateTime startTime = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 10, 0, 0);
            DateTime endTime = startTime.AddHours(10);

            Request.ExceptionsException exception = new Request.ExceptionsException();
            exception.ExceptionStartTime = startTime.AddDays(2).ToString("yyyyMMddTHHmmssZ");
            Request.Exceptions exceptions = new Request.Exceptions() { Exception = new Request.ExceptionsException[] { exception } };

            Request.Recurrence recurrence = new Request.Recurrence
            {
                Type = 0
            };

            Request.SyncCollectionAdd recurrenceCalendarData = new Request.SyncCollectionAdd
            {
                ClientId = TestSuiteBase.ClientId,
                ApplicationData =
                    new Request.SyncCollectionAddApplicationData
                    {
                        ItemsElementName =
                            new Request.ItemsChoiceType8[] 
                            { 
                                Request.ItemsChoiceType8.Subject, Request.ItemsChoiceType8.Location,
                                Request.ItemsChoiceType8.StartTime, Request.ItemsChoiceType8.EndTime,
                                Request.ItemsChoiceType8.Recurrence, Request.ItemsChoiceType8.Exceptions,
                                Request.ItemsChoiceType8.UID
                            },
                        Items =
                        new object[] 
                        { 
                            recurrenceCalendarSubject, location, 
                            startTime.ToString("yyyyMMddTHHmmssZ"),
                            endTime.ToString("yyyyMMddTHHmmssZ"),
                            recurrence, exceptions, Guid.NewGuid().ToString()
                        }
                    },
                Class = "Calendar"
            };

            SyncRequest syncRequest = TestSuiteBase.CreateSyncAddRequest(this.LastSyncKey, this.User1Information.CalendarCollectionId, recurrenceCalendarData);
            SyncResponse syncResponse = this.Sync(syncRequest);
            Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");
            Response.SyncCollectionsCollectionResponses responses = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Responses) as Response.SyncCollectionsCollectionResponses;
            Site.Assert.AreEqual<int>(1, int.Parse(responses.Add[0].Status), "The calendar should be added successfully.");
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.CalendarCollectionId, recurrenceCalendarSubject);

            syncResponse = this.SyncChanges(this.User1Information.CalendarCollectionId);
            string serverId = TestSuiteBase.FindServerId(syncResponse, "Subject", recurrenceCalendarSubject);
            Site.Assert.IsNotNull(serverId, "The recurrence calendar should be found.");
            #endregion

            #region Change the subject of the added recurrence calendar.
            string updatedCalendarSubject = Common.GenerateResourceName(Site, "updatedCalendarSubject");

            Request.SyncCollectionChangeApplicationData changeCalednarData = new Request.SyncCollectionChangeApplicationData();
            changeCalednarData.ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.Subject, Request.ItemsChoiceType7.Recurrence };
            changeCalednarData.Items = new object[] { updatedCalendarSubject, recurrence };

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

            syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User1Information.CalendarCollectionId, 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.CalendarCollectionId, recurrenceCalendarSubject);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.CalendarCollectionId, updatedCalendarSubject);

            syncResponse = this.SyncChanges(this.User1Information.CalendarCollectionId);
            serverId = TestSuiteBase.FindServerId(syncResponse, "Subject", updatedCalendarSubject);
            Site.Assert.IsNotNull(serverId, "The recurrence calendar should be found.");

            Response.SyncCollectionsCollectionCommands commands = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Commands) as Response.SyncCollectionsCollectionCommands;
            Site.Assert.IsNotNull(commands.Add, "The Add element should not be null.");

            foreach (Response.SyncCollectionsCollectionCommandsAdd item in commands.Add)
            {
                if (item.ServerId == serverId)
                {
                    for (int i = 0; i < item.ApplicationData.ItemsElementName.Length; i++)
                    {
                        if (item.ApplicationData.ItemsElementName[i] == Response.ItemsChoiceType8.Exceptions)
                        {
                            Response.Exceptions currentExceptions = item.ApplicationData.Items[i] as Response.Exceptions;
                            Site.Assert.IsNotNull(currentExceptions, "The Exceptions element should exist.");

                            Response.ExceptionsException currentException = currentExceptions.Exception[0];

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

                            // Verify MS-ASCMD requirement: MS-ASCMD_R877
                            Site.CaptureRequirementIfAreEqual<string>(
                                exception.ExceptionStartTime.ToString(),
                                currentException.ExceptionStartTime.ToString(),
                                877,
                                @"[In Change] If a calendar:Exception ([MS-ASCAL] section 2.2.2.19) node within the calendar:Exceptions node is not present, that particular exception will remain unchanged.");

                            break;
                        }
                    }

                    break;
                }
            }
            #endregion

            #region Change the subject of the added recurrence calendar again.
            string allNewCalendarSubject = Common.GenerateResourceName(Site, "updatedCalendarSubject");

            changeCalednarData.ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.Subject, Request.ItemsChoiceType7.Recurrence, Request.ItemsChoiceType7.Exceptions, Request.ItemsChoiceType7.UID };
            changeCalednarData.Items = new object[] { allNewCalendarSubject, recurrence, null, Guid.NewGuid().ToString() };

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

            syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User1Information.CalendarCollectionId, 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.CalendarCollectionId, updatedCalendarSubject);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.CalendarCollectionId, allNewCalendarSubject);

            syncResponse = this.SyncChanges(this.User1Information.CalendarCollectionId);
            serverId = TestSuiteBase.FindServerId(syncResponse, "Subject", allNewCalendarSubject);
            Site.Assert.IsNotNull(serverId, "The recurrence calendar should be found.");

            commands = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Commands) as Response.SyncCollectionsCollectionCommands;
            Site.Assert.IsNotNull(commands.Add, "The Add element should not be null.");

            foreach (Response.SyncCollectionsCollectionCommandsAdd item in commands.Add)
            {
                if (item.ServerId == serverId)
                {
                    for (int i = 0; i < item.ApplicationData.ItemsElementName.Length; i++)
                    {
                        if (item.ApplicationData.ItemsElementName[i] == Response.ItemsChoiceType8.Exceptions)
                        {
                            Response.Exceptions currentExceptions = item.ApplicationData.Items[i] as Response.Exceptions;
                            Site.Assert.IsNotNull(currentExceptions, "The Exceptions element should exist.");

                            Response.ExceptionsException currentException = currentExceptions.Exception[0];

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

                            // Verify MS-ASCMD requirement: MS-ASCMD_R876
                            Site.CaptureRequirementIfAreEqual<string>(
                                exception.ExceptionStartTime.ToString(),
                                currentException.ExceptionStartTime.ToString(),
                                876,
                                @"[In Change] [Certain in-schema properties remain untouched in the following three cases:] If a calendar:Exceptions ([MS-ASCAL] section 2.2.2.20) node is not specified, the properties for that calendar:Exceptions node will remain unchanged.");

                            break;
                        }
                    }

                    break;
                }
            }
            #endregion
        }
コード例 #21
0
        public void MSASAIRS_S02_TC10_IncludedBodyInResponse()
        {
            #region Send a plain text email
            string subject = Common.GenerateResourceName(Site, "Subject");
            string body = Common.GenerateResourceName(Site, "Body");
            this.SendEmail(EmailType.Plaintext, subject, body);
            #endregion

            #region Verify Sync command related elements
            DataStructures.Sync syncItem = this.GetSyncResult(subject, this.User2Information.InboxCollectionId, null, null, null);

            Site.Assert.IsNotNull(
                syncItem.Email.Body,
                "The Body element should be included in a response message whenever new items are created.");
            #endregion

            #region Verify ItemOperations related elements
            DataStructures.ItemOperations itemOperationsItem = this.GetItemOperationsResult(this.User2Information.InboxCollectionId, syncItem.ServerId, null, null, null, null);

            Site.Assert.IsNotNull(
                itemOperationsItem.Email.Body,
                "The Body element should be included in a response message whenever new items are created.");
            #endregion

            #region Verify Search command related elements
            DataStructures.Search searchItem = this.GetSearchResult(subject, this.User2Information.InboxCollectionId, itemOperationsItem.Email.ConversationId, null, null);

            Site.Assert.IsNotNull(
                searchItem.Email.Body,
                "The Body element should be included in a response message whenever new items are created.");
            #endregion

            #region Verify requirements
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R105");

            // Verify MS-ASAIRS requirement: MS-ASAIRS_R105
            Site.CaptureRequirement(
                105,
                @"[In Body] The Body element MUST be included in a response message whenever [an item has changes or] new items are created.");
            #endregion

            #region Update Read property of the item
            Request.SyncCollectionChange changeData = new Request.SyncCollectionChange
            {
                ServerId = syncItem.ServerId,
                ApplicationData =
                    new Request.SyncCollectionChangeApplicationData
                    {
                        Items = new object[] { !syncItem.Email.Read },
                        ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.Read }
                    }
            };

            Request.SyncCollection syncCollection = TestSuiteHelper.CreateSyncCollection(this.SyncKey, this.User2Information.InboxCollectionId);
            syncCollection.Commands = new object[] { changeData };

            SyncRequest request = Common.CreateSyncRequest(new Request.SyncCollection[] { syncCollection });

            // Call Sync command to update the item
            DataStructures.SyncStore syncStore = this.ASAIRSAdapter.Sync(request);

            Site.Assert.AreEqual<byte>(
                1,
                syncStore.CollectionStatus,
                "The server should return status 1 in the Sync command response to indicate sync command executes successfully.");
            #endregion

            #region Verify Sync command after update item
            DataStructures.Sync updatedSyncItem = this.GetSyncResult(subject, this.User2Information.InboxCollectionId, null, null, null);

            // Assert the Read has been changed to the new value
            Site.Assert.AreEqual<bool?>(
                !syncItem.Email.Read,
                updatedSyncItem.Email.Read,
                "The Read property of the item should be updated.");

            // Assert the body is not null when the item property is changed
            Site.Assert.IsNotNull(
                updatedSyncItem.Email.Body,
                "The Body element should be included in a response message whenever an item has changes.");
            #endregion

            #region Verify ItemOperations command after update item
            DataStructures.ItemOperations updatedItemOperationItem = this.GetItemOperationsResult(this.User2Information.InboxCollectionId, updatedSyncItem.ServerId, null, null, null, null);

            // Assert the Read has been changed to the new value
            Site.Assert.AreEqual<bool?>(
                !itemOperationsItem.Email.Read,
                updatedItemOperationItem.Email.Read,
                "The Read property of the item should be updated.");

            // Assert the body is not null when the item property is changed
            Site.Assert.IsNotNull(
                updatedItemOperationItem.Email.Body,
                "The Body element should be included in a response message whenever an item has changes.");
            #endregion

            #region Verify Search command after update item
            DataStructures.Search updateSearchItem = this.GetSearchResult(subject, this.User2Information.InboxCollectionId, updatedItemOperationItem.Email.ConversationId, null, null);

            // Assert the Read has been changed to the new value
            Site.Assert.AreEqual<bool?>(
               !searchItem.Email.Read,
               updateSearchItem.Email.Read,
               "The Read property of the item should be updated.");

            // Assert the body is not null when the item property is changed
            Site.Assert.IsNotNull(
                updateSearchItem.Email.Body,
                "The Body element should be included in a response message whenever an item has changes.");
            #endregion

            #region Verify requirements
            // According to above steps, requirement MS-ASAIRS_R386 can be captured directly
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R386");

            // Verify MS-ASAIRS requirement: MS-ASAIRS_R386
            Site.CaptureRequirement(
                386,
                @"[In Body] The Body element MUST be included in a response message whenever an item has changes [or new items are created].");
            #endregion
        }
コード例 #22
0
        public void MSASCNTC_S01_TC03_Sync_GhostedElement_AssistantName()
        {
            #region Call Sync command with Add element to add a contact to the server
            Dictionary<Request.ItemsChoiceType8, object> contactProperties = this.SetContactProperties(null);
            this.AddContact(this.User1Information.ContactsCollectionId, contactProperties);

            this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.ContactsCollectionId, contactProperties[Request.ItemsChoiceType8.FileAs].ToString());
            #endregion

            #region Call Sync command with Supported element in initial Sync request to synchronize the contact item that added in previous step
            // Put JobTitle into the Supported element
            Request.Supported supportedElements = new Request.Supported
            {
                Items = new object[] { string.Empty },
                ItemsElementName = new Request.ItemsChoiceType[] { Request.ItemsChoiceType.JobTitle }
            };

            // Set the BodyPreference element in Sync command request
            Request.BodyPreference bodyPreference = new Request.BodyPreference { Type = 1 };

            // Get the new added contact
            Sync newAddedItem = this.GetSyncAddResult(contactProperties[Request.ItemsChoiceType8.FileAs].ToString(), this.User1Information.ContactsCollectionId, bodyPreference, supportedElements);
            #endregion

            #region Call Sync command with Change element to change the JobTitle value of the contact
            Request.SyncCollectionChange changeData = new Request.SyncCollectionChange
            {
                ApplicationData = new Request.SyncCollectionChangeApplicationData
                {
                    Items = new object[] { "EditedJobTitle" },
                    ItemsElementName = new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.JobTitle }
                },
                ServerId = newAddedItem.ServerId
            };

            this.UpdateContact(this.SyncKey, this.User1Information.ContactsCollectionId, changeData);
            #endregion

            #region Call Sync command with Supported element in initial Sync request to synchronize the changed contact on the server
            // Get the updated contact
            Sync changedItem = this.GetSyncChangeResult(contactProperties[Request.ItemsChoiceType8.FileAs].ToString(), this.User1Information.ContactsCollectionId, this.SyncKey, bodyPreference);

            Site.Assert.AreEqual<string>(
                "EditedJobTitle",
                changedItem.Contact.JobTitle,
                "The value of JobTitle should be changed.");
            #endregion

            #region Verify requirements
            // If the value of the AssistantName element in the Sync Change response equals the value in the Sync Add response, it means the existing value for the AssistantName element is preserved, then requirements MS-ASCNTC_R461 and MS-ASCNTC_R115 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R115");

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R115
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.AssistantName,
                changedItem.Contact.AssistantName,
                115,
                @"[In AssistantName] This element[AssistantName] can be ghosted.");

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

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R461
            Site.CaptureRequirementIfAreEqual<string>(
                newAddedItem.Contact.Body.Data,
                changedItem.Contact.Body.Data,
                461,
                @"[In Truncating the Contact Notes Field]If an airsyncbase:Body element is not included in the request that is sent from the client to the server, the server MUST NOT delete the stored Notes for the contact.");
            #endregion
        }