/// <summary> /// Create an initial Sync request by using the specified collection Id. /// </summary> /// <param name="collectionId">Identify the folder as the collection being synchronized.</param> /// <param name="supportedElements">The elements in Supported element.</param> /// <returns>The SyncRequest instance.</returns> internal static SyncRequest CreateInitialSyncRequest(string collectionId, Request.Supported supportedElements) { Request.SyncCollection syncCollection = new Request.SyncCollection { CollectionId = collectionId, SyncKey = "0", Supported = supportedElements }; return(Common.CreateSyncRequest(new Request.SyncCollection[] { syncCollection })); }
/// <summary> /// Initialize the sync with server /// </summary> /// <param name="collectionId">Specify the folder collection Id which needs to be synced.</param> /// <param name="supported">Specifies which contact and calendar elements in a Sync request are managed by the client and therefore not ghosted.</param> /// <returns>Return Sync response</returns> public SyncStore InitializeSync(string collectionId, Request.Supported supported) { // Obtains the key by sending an initial Sync request with a SyncKey element value of zero and the CollectionId element SyncRequest initializeSyncRequest = TestSuiteHelper.InitializeSyncRequest(collectionId, supported); SyncStore initializeSyncResponse = this.CALAdapter.Sync(initializeSyncRequest); // Verify sync result Site.Assert.AreEqual <byte>( 1, initializeSyncResponse.CollectionStatus, "If the Sync command executes successfully, the Status in response should be 1."); return(initializeSyncResponse); }
/// <summary> /// Builds a initial Sync request by using the specified collection Id. /// In order to sync the content of a folder, an initial sync key for the folder MUST be obtained from the server. /// The client obtains the key by sending an initial Sync request with a SyncKey element value of zero and the CollectionId element /// In general, returns the XML formatted Sync request as follows: /// <!-- /// <?xml version="1.0" encoding="utf-8"?> /// <Sync xmlns="AirSync"> /// <Collections> /// <Collection> /// <SyncKey>0</SyncKey> /// <CollectionId>5</CollectionId> /// </Collection> /// </Collections> /// </Sync> /// --> /// </summary> /// <param name="collectionId">Identify the folder as the collection being synchronized, which can be returned by ActiveSync FolderSync command(Refer to [MS-ASCMD]2.2.3.30.5)</param> /// <param name="supported">Specifies which contact and calendar elements in a Sync request are managed by the client and therefore not ghosted.</param> /// <returns>Returns the SyncRequest instance</returns> internal static SyncRequest InitializeSyncRequest(string collectionId, Request.Supported supported) { Request.SyncCollection syncCollection = new Request.SyncCollection { Supported = supported, WindowSize = "512", CollectionId = collectionId, SyncKey = "0" }; List <object> items = new List <object>(); List <Request.ItemsChoiceType1> itemsElementName = new List <Request.ItemsChoiceType1> { Request.ItemsChoiceType1.BodyPreference }; items.Add( new Request.BodyPreference() { TruncationSize = 0, TruncationSizeSpecified = false, Type = 2, Preview = 0, PreviewSpecified = false, }); Request.Options option = new Request.Options { Items = items.ToArray(), ItemsElementName = itemsElementName.ToArray() }; syncCollection.Options = new Request.Options[] { option }; SyncRequest request = Common.CreateSyncRequest(new Request.SyncCollection[] { syncCollection }); return(request); }
public void MSASCMD_S19_TC46_Sync_Supported_Status4() { #region Add a new contact. this.Sync(TestSuiteBase.CreateEmptySyncRequest(this.User1Information.ContactsCollectionId)); string contactFileAS = Common.GenerateResourceName(Site, "FileAS"); Request.SyncCollectionAdd addData = this.CreateAddContactCommand("FirstName", "MiddleName", "LastName", contactFileAS, "Vice President"); SyncRequest syncRequest = TestSuiteBase.CreateSyncAddRequest(this.LastSyncKey, this.User1Information.ContactsCollectionId, addData); 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 new contact should be added successfully."); TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.ContactsCollectionId, contactFileAS); this.FolderSync(); #endregion #region Call Sync command without specifying CollectionId. Request.Supported supported = new Request.Supported { ItemsElementName = new Request.ItemsChoiceType[] { Request.ItemsChoiceType.JobTitle } }; syncRequest = TestSuiteBase.CreateEmptySyncRequest(this.User1Information.ContactsCollectionId); syncRequest.RequestData.Collections[0].CollectionId = null; syncRequest.RequestData.Collections[0].Supported = supported; syncResponse = this.Sync(syncRequest); Site.Assert.IsNotNull(syncResponse.ResponseData, "The response data returned in the Sync command response should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4545"); // Verify MS-ASCMD requirement: MS-ASCMD_R4545 Site.CaptureRequirementIfAreEqual<int>( 4, int.Parse(syncResponse.ResponseData.Status), 4545, @"[In Supported] A Status element (section 2.2.3.162.16) value of 4 is returned in the Sync response if the CollectionId element is not included in the Sync request."); #endregion }
public void MSASCMD_S19_TC39_Sync_Supported() { #region Add a new contact. this.Sync(TestSuiteBase.CreateEmptySyncRequest(this.User1Information.ContactsCollectionId)); string contactFileAS = Common.GenerateResourceName(Site, "FileAS"); Request.SyncCollectionAdd addData = this.CreateAddContactCommand("FirstName", "MiddleName", "LastName", contactFileAS, "Vice President"); 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 responses = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Responses) as Response.SyncCollectionsCollectionResponses; Site.Assert.AreEqual<int>(1, int.Parse(responses.Add[0].Status), "The new contact should be added successfully."); TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.ContactsCollectionId, contactFileAS); #endregion #region Call Sync command without Supported element to indicate to the server that elements that can be ghosted are considered not ghosted. this.FolderSync(); syncResponse = this.SyncChanges(this.User1Information.ContactsCollectionId); 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.IsTrue(!string.IsNullOrEmpty(serverId), "The contact should exist in the Contact folder."); #endregion #region Call Sync change operation to change the JobTitle element. Request.SyncCollectionChange appDataChange2 = CreateChangedContact(serverId, new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.JobTitle }, new object[] { "President" }); syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User1Information.ContactsCollectionId, appDataChange2); syncResponse = this.Sync(syncRequest); Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null."); Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The Sync command should succeed."); syncResponse = this.SyncChanges(this.User1Information.ContactsCollectionId); Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null."); bool isVerifyR5906 = true; Response.SyncCollectionsCollectionCommandsAddApplicationData applicationData1 = TestSuiteBase.GetAddApplicationData(syncResponse, Response.ItemsChoiceType8.FileAs, contactFileAS); Site.Assert.IsNotNull(applicationData1, "The application data of the contact item should not be null."); Site.Assert.IsNotNull(applicationData1.ItemsElementName, "The ItemsElementName should not be null."); Site.Assert.IsTrue(applicationData1.ItemsElementName.Length > 0, "The length of ItemsElementName should be greater then 0."); for (int i = 0; i < applicationData1.ItemsElementName.Length; i++) { if (applicationData1.ItemsElementName[i] == Response.ItemsChoiceType8.FirstName || applicationData1.ItemsElementName[i] == Response.ItemsChoiceType8.MiddleName || applicationData1.ItemsElementName[i] == Response.ItemsChoiceType8.LastName) { isVerifyR5906 = false; break; } } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5906"); // Verify MS-ASCMD requirement: MS-ASCMD_R5906 Site.CaptureRequirementIfIsTrue( isVerifyR5906, 5906, @"[In Supported] The status of properties that can be ghosted is determined by the client's usage of the Supported element in the initial Sync command request for the containing folder, according to the following rules:1. If the client does not include a Supported element in the initial Sync command request for a folder, then all of the elements that can be ghosted are considered not ghosted."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5912"); // Verify MS-ASCMD requirement: MS-ASCMD_R5912 Site.CaptureRequirementIfIsTrue( isVerifyR5906, 5912, @"[In Supported] [When an existing item is modified via the Change element (section 2.2.3.24) in a Sync command request, the result of omitting an element that can be ghosted changes depending on the status of the element.] If the element is not ghosted, any existing value for that element is deleted."); #endregion #region Add a new contact. this.Sync(TestSuiteBase.CreateEmptySyncRequest(this.User1Information.ContactsCollectionId)); contactFileAS = Common.GenerateResourceName(this.Site, "FileAS"); addData = this.CreateAddContactCommand("FirstName", "MiddleName", "LastName", contactFileAS, "Vice President"); syncRequest = TestSuiteBase.CreateSyncAddRequest(this.LastSyncKey, this.User1Information.ContactsCollectionId, addData); syncResponse = this.Sync(syncRequest, false); Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null."); responses = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Responses) as Response.SyncCollectionsCollectionResponses; Site.Assert.AreEqual<int>(1, int.Parse(responses.Add[0].Status), "The new contact should be added successfully."); TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.ContactsCollectionId, contactFileAS); #endregion #region Call Sync command to indicate to the server that JobTitle element is not ghosted. Request.Supported supported = new Request.Supported { Items = new object[] { string.Empty }, ItemsElementName = new Request.ItemsChoiceType[] { Request.ItemsChoiceType.JobTitle } }; syncRequest = TestSuiteBase.CreateEmptySyncRequest(this.User1Information.ContactsCollectionId); syncRequest.RequestData.Collections[0].Supported = supported; this.Sync(syncRequest); syncRequest.RequestData.Collections[0].SyncKey = this.LastSyncKey; syncRequest.RequestData.Collections[0].GetChanges = true; syncRequest.RequestData.Collections[0].GetChangesSpecified = true; syncResponse = this.Sync(syncRequest); 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.IsTrue(!string.IsNullOrEmpty(serverId), "The contact should exist in the Contact folder."); #endregion #region Call Sync change operation to change the FileAS element string updatedContactFileAs = Common.GenerateResourceName(Site, "UpdatedFileAs"); Request.SyncCollectionChange appDataChange3 = CreateChangedContact(serverId, new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.FileAs }, new object[] { updatedContactFileAs }); syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User1Information.ContactsCollectionId, appDataChange3); syncResponse = this.Sync(syncRequest); Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null."); Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The Sync command should be conducted successfully."); TestSuiteBase.RemoveRecordCaseRelativeItems(this.User1Information, this.User1Information.ContactsCollectionId, contactFileAS); TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.ContactsCollectionId, updatedContactFileAs); syncRequest = TestSuiteBase.CreateEmptySyncRequest(this.User1Information.ContactsCollectionId); this.Sync(syncRequest); syncRequest.RequestData.Collections[0].SyncKey = this.LastSyncKey; syncRequest.RequestData.Collections[0].Supported = supported; syncResponse = this.Sync(syncRequest); Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null."); bool isVerifyR5907 = true; Response.SyncCollectionsCollectionCommandsAddApplicationData applicationData2 = TestSuiteBase.GetAddApplicationData(syncResponse, Response.ItemsChoiceType8.FileAs, updatedContactFileAs); Site.Assert.IsNotNull(applicationData2, "The application data of the contact item should not be null."); Site.Assert.IsNotNull(applicationData2.ItemsElementName, "The ItemsElementName should not be null."); Site.Assert.IsTrue(applicationData2.ItemsElementName.Length > 0, "The length of ItemsElementName should be greater then 0."); for (int i = 0; i < applicationData2.ItemsElementName.Length; i++) { if (applicationData2.ItemsElementName[i] == Response.ItemsChoiceType8.JobTitle && applicationData2.Items[i].ToString() == "Vice President") { isVerifyR5907 = false; break; } } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5907"); // Verify MS-ASCMD requirement: MS-ASCMD_R5907 Site.CaptureRequirementIfIsTrue( isVerifyR5907, 5907, @"[In Supported] [The status of properties that can be ghosted is determined by the client's usage of the Supported element in the initial Sync command request for the containing folder, according to the following rules:] 2. If the client includes a Supported element that contains child elements in the initial Sync command request for a folder, then each child element of that Supported element is considered not ghosted."); bool isFirstNameGhosted = false; bool isMiddleNameGhosted = false; bool isLastNameGhosted = false; foreach (Response.ItemsChoiceType8 name in applicationData2.ItemsElementName) { if (name == Response.ItemsChoiceType8.FirstName) { isFirstNameGhosted = true; } else if (name == Response.ItemsChoiceType8.MiddleName) { isMiddleNameGhosted = true; } else if (name == Response.ItemsChoiceType8.LastName) { isLastNameGhosted = true; } } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5911"); // Verify MS-ASCMD requirement: MS-ASCMD_R5911 Site.CaptureRequirementIfIsTrue( isFirstNameGhosted && isMiddleNameGhosted && isLastNameGhosted, 5911, @"[In Supported] [When an existing item is modified via the Change element (section 2.2.3.24) in a Sync command request, the result of omitting an element that can be ghosted changes depending on the status of the element.] If the element is ghosted, any existing value for that element is preserved."); #endregion #region Add a new contact. this.Sync(TestSuiteBase.CreateEmptySyncRequest(this.User1Information.ContactsCollectionId)); contactFileAS = Common.GenerateResourceName(this.Site, "FileAS"); addData = this.CreateAddContactCommand("FirstName", "MiddleName", "LastName", contactFileAS, "Vice President"); syncRequest = TestSuiteBase.CreateSyncAddRequest(this.LastSyncKey, this.User1Information.ContactsCollectionId, addData); syncResponse = this.Sync(syncRequest, false); Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null."); responses = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Responses) as Response.SyncCollectionsCollectionResponses; Site.Assert.AreEqual<int>(1, int.Parse(responses.Add[0].Status), "The new contact should be added successfully."); TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.ContactsCollectionId, contactFileAS); #endregion #region Call Sync command with empty Supported element. syncRequest = TestSuiteBase.CreateEmptySyncRequest(this.User1Information.ContactsCollectionId); syncRequest.RequestData.Collections[0].Supported = null; this.Sync(syncRequest); syncRequest.RequestData.Collections[0].SyncKey = this.LastSyncKey; syncRequest.RequestData.Collections[0].GetChanges = true; syncRequest.RequestData.Collections[0].GetChangesSpecified = true; syncResponse = this.Sync(syncRequest); 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.IsTrue(!string.IsNullOrEmpty(serverId), "The contact should exist in the Contact folder."); #endregion #region Call Sync change operation to change the JobTitle element Request.SyncCollectionChange appDataChange4 = CreateChangedContact(serverId, new Request.ItemsChoiceType7[] { Request.ItemsChoiceType7.JobTitle }, new object[] { "President" }); syncRequest = CreateSyncChangeRequest(this.LastSyncKey, this.User1Information.ContactsCollectionId, appDataChange4); syncResponse = this.Sync(syncRequest); Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null."); Site.Assert.AreEqual<uint>(1, Convert.ToUInt32(TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Status)), "The Sync command should be conducted successfully."); syncResponse = this.SyncChanges(this.User1Information.ContactsCollectionId); Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null."); Response.SyncCollectionsCollectionCommandsAddApplicationData applicationData3 = TestSuiteBase.GetAddApplicationData(syncResponse, Response.ItemsChoiceType8.FileAs, contactFileAS); Site.Assert.IsNotNull(applicationData3, "The application data of the contact item should not be null."); isFirstNameGhosted = false; isMiddleNameGhosted = false; isLastNameGhosted = false; foreach (Response.ItemsChoiceType8 itemElementName in applicationData3.ItemsElementName) { switch (itemElementName) { case Response.ItemsChoiceType8.FirstName: isFirstNameGhosted = true; break; case Response.ItemsChoiceType8.MiddleName: isMiddleNameGhosted = true; break; case Response.ItemsChoiceType8.LastName: isLastNameGhosted = true; break; } } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5909"); // Verify MS-ASCMD requirement: MS-ASCMD_R5909 Site.CaptureRequirementIfIsFalse( isFirstNameGhosted && isMiddleNameGhosted && isLastNameGhosted, 5909, @"[In Supported] [The status of properties that can be ghosted is determined by the client's usage of the Supported element in the initial Sync command request for the containing folder, according to the following rules:] 3. If the client includes an empty Supported element in the initial Sync command request for a folder, then all elements that can be ghosted are considered ghosted."); #endregion }
public void MSASCAL_S01_TC31_UnchangedExceptions() { 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 Calls 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); DateTime startTimeInException = exceptionStartTime.AddMinutes(15); DateTime endTimeInException = startTimeInException.AddHours(2); // 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); calendarItem.Add(Request.ItemsChoiceType8.Recurrence, recurrence); // 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.StartTime = startTimeInException.ToString("yyyyMMddTHHmmssZ"); exception.EndTime = endTimeInException.ToString("yyyyMMddTHHmmssZ"); exception.Subject = "Calendar Exception"; exception.Location = "Room 666"; exceptionList.Add(exception); exceptions.Exception = exceptionList.ToArray(); calendarItem.Add(Request.ItemsChoiceType8.Exceptions, exceptions); 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 Calls Sync command to Sync calendars from the server. // Set Supported Element Request.Supported supportedElement = new Request.Supported(); Dictionary<Request.ItemsChoiceType, object> supportedItem = new Dictionary<Request.ItemsChoiceType, object> { { Request.ItemsChoiceType.Exceptions, exceptions }, { Request.ItemsChoiceType.DtStamp, string.Empty }, { Request.ItemsChoiceType.Categories, TestSuiteHelper.CreateCalendarCategories(new string[] { "Categories" }) }, { Request.ItemsChoiceType.Sensitivity, (byte)1 }, { Request.ItemsChoiceType.BusyStatus, (byte)1 }, { Request.ItemsChoiceType.UID, string.Empty }, { Request.ItemsChoiceType.Timezone, string.Empty }, { Request.ItemsChoiceType.StartTime, string.Empty }, { Request.ItemsChoiceType.EndTime, string.Empty }, { Request.ItemsChoiceType.Subject, string.Empty }, { Request.ItemsChoiceType.Location, string.Empty }, { Request.ItemsChoiceType.Recurrence, recurrence }, { Request.ItemsChoiceType.AllDayEvent, (byte)1 }, { Request.ItemsChoiceType.Reminder, string.Empty } }; supportedElement.Items = supportedItem.Values.ToArray<object>(); supportedElement.ItemsElementName = supportedItem.Keys.ToArray<Request.ItemsChoiceType>(); // Sync calendars with supported element SyncStore syncResponse1 = this.InitializeSync(this.User1Information.CalendarCollectionId, supportedElement); SyncRequest syncRequest = TestSuiteHelper.CreateSyncRequest(this.User1Information.CalendarCollectionId, syncResponse1.SyncKey, true); SyncStore syncResponse2 = this.CALAdapter.Sync(syncRequest); SyncItem createdCalendar = new SyncItem(); foreach (SyncItem item in syncResponse2.AddElements) { if (item.Calendar.Subject == subject) { createdCalendar = item; break; } } Site.Assert.IsNotNull(createdCalendar.Calendar, "The calendar with subject {0} should exist in server.", subject); syncRequest = TestSuiteHelper.CreateSyncRequest(this.User1Information.CalendarCollectionId, syncResponse2.SyncKey, false); SyncStore syncResponse3 = this.CALAdapter.Sync(syncRequest); Site.Assert.AreEqual<int>( 0, syncResponse3.AddResponses.Count, "This Sync command response should be null."); SyncItem updatedCalendar = this.GetChangeItem(this.User1Information.CalendarCollectionId, subject); Site.Assert.IsNotNull(updatedCalendar.Calendar, "The calendar with subject {0} should exist in server.", subject); #endregion // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCAL_R54111"); // Verify MS-ASCAL requirement: MS-ASCAL_R54111 Site.CaptureRequirementIfIsTrue( createdCalendar.Calendar.Exceptions.Exception[0].ExceptionStartTime == calendar.Calendar.Exceptions.Exception[0].ExceptionStartTime && createdCalendar.Calendar.Exceptions.Exception[0].StartTime == calendar.Calendar.Exceptions.Exception[0].StartTime && createdCalendar.Calendar.Exceptions.Exception[0].EndTime == calendar.Calendar.Exceptions.Exception[0].EndTime && createdCalendar.Calendar.Exceptions.Exception[0].Subject == calendar.Calendar.Exceptions.Exception[0].Subject && createdCalendar.Calendar.Exceptions.Exception[0].Location == calendar.Calendar.Exceptions.Exception[0].Location, 54111, @"[In Removing Exceptions] [If an Exceptions element (section 2.2.2.20) is not specified in a Sync command request ([MS-ASCMD] section 2.2.2.19.2), then] any exceptions previously defined are unchanged, even if the client included the Exceptions element as a child of the Supported element, as specified in [MS-ASCMD] section 2.2.3.164."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCAL_R541"); // Verify MS-ASCAL requirement: MS-ASCAL_R541 Site.CaptureRequirementIfIsTrue( updatedCalendar.Calendar.Exceptions.Exception[0].ExceptionStartTime == calendar.Calendar.Exceptions.Exception[0].ExceptionStartTime && updatedCalendar.Calendar.Exceptions.Exception[0].StartTime == calendar.Calendar.Exceptions.Exception[0].StartTime && updatedCalendar.Calendar.Exceptions.Exception[0].EndTime == calendar.Calendar.Exceptions.Exception[0].EndTime && updatedCalendar.Calendar.Exceptions.Exception[0].Subject == calendar.Calendar.Exceptions.Exception[0].Subject && updatedCalendar.Calendar.Exceptions.Exception[0].Location == calendar.Calendar.Exceptions.Exception[0].Location, 541, @"[In Removing Exceptions] If an Exceptions element (section 2.2.2.20) is not specified in a Sync command request ([MS-ASCMD] section 2.2.2.19), then any exceptions previously defined are unchanged. "); }
public void MSASCAL_S01_TC28_GhostedElements() { #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); DateTime startTimeInException = exceptionStartTime.AddMinutes(15); DateTime endTimeInException = startTimeInException.AddHours(2); // 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.StartTime = startTimeInException.ToString("yyyyMMddTHHmmssZ"); exception.EndTime = endTimeInException.ToString("yyyyMMddTHHmmssZ"); exception.Subject = "Calendar Exception"; exception.Location = "Room 666"; exceptionList.Add(exception); exceptions.Exception = exceptionList.ToArray(); if (this.IsActiveSyncProtocolVersion121 || this.IsActiveSyncProtocolVersion140 || this.IsActiveSyncProtocolVersion141) { calendarItem.Add(Request.ItemsChoiceType8.Recurrence, recurrence); calendarItem.Add(Request.ItemsChoiceType8.Exceptions, exceptions); calendarItem.Add(Request.ItemsChoiceType8.Location, this.Location); } // Set elements which can be ghosted 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.SyncChanges(this.User1Information.CalendarCollectionId); #endregion #region Call Sync command to change a calendar element, and sync calendars from the server. // To support ghosted elements of Calendar, following elements must be included in Supported element. Request.Supported supportedElement = null; // All Calendar class properties are ghosted by default when protocol version 16.0 is used. if (this.IsActiveSyncProtocolVersion121 || this.IsActiveSyncProtocolVersion140 || this.IsActiveSyncProtocolVersion141) { supportedElement = new Request.Supported(); Dictionary<Request.ItemsChoiceType, object> supportedItem = new Dictionary<Request.ItemsChoiceType, object> { { Request.ItemsChoiceType.Exceptions, exceptions }, { Request.ItemsChoiceType.DtStamp, string.Empty }, { Request.ItemsChoiceType.Categories, TestSuiteHelper.CreateCalendarCategories(new string[] { "Categories" }) }, { Request.ItemsChoiceType.Sensitivity, (byte)1 }, { Request.ItemsChoiceType.BusyStatus, (byte)1 }, { Request.ItemsChoiceType.UID, string.Empty }, { Request.ItemsChoiceType.Timezone, string.Empty }, { Request.ItemsChoiceType.StartTime, string.Empty }, { Request.ItemsChoiceType.EndTime, string.Empty }, { Request.ItemsChoiceType.Subject, string.Empty }, { Request.ItemsChoiceType.Location, string.Empty }, { Request.ItemsChoiceType.Recurrence, recurrence }, { Request.ItemsChoiceType.AllDayEvent, (byte)1 }, { Request.ItemsChoiceType.Reminder, string.Empty } }; supportedElement.Items = supportedItem.Values.ToArray<object>(); supportedElement.ItemsElementName = supportedItem.Keys.ToArray<Request.ItemsChoiceType>(); } // Sync calendars with supported element SyncStore syncResponse1 = this.InitializeSync(this.User1Information.CalendarCollectionId, supportedElement); SyncRequest syncRequest = TestSuiteHelper.CreateSyncRequest(this.User1Information.CalendarCollectionId, syncResponse1.SyncKey, true); SyncStore syncResponse2 = this.CALAdapter.Sync(syncRequest); // Update Subject value Dictionary<Request.ItemsChoiceType7, object> changeItem = new Dictionary<Request.ItemsChoiceType7, object>(); string newSubject = Common.GenerateResourceName(Site, "newSubject"); changeItem.Add(Request.ItemsChoiceType7.Subject, newSubject); this.UpdateCalendarProperty(calendar.ServerId, this.User1Information.CalendarCollectionId, syncResponse2.SyncKey, changeItem); SyncItem newCalendar = this.GetChangeItem(this.User1Information.CalendarCollectionId, newSubject); if (newCalendar.Calendar != null) { this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.CalendarCollectionId, newSubject); } else { this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.CalendarCollectionId, subject); Site.Assert.IsNotNull(newCalendar.Calendar, "The calendar with subject {0} should exist in server.", newSubject); } #endregion #region Verify Requirements. Site.Assert.IsNotNull(newCalendar.Calendar.Body, "The Body element should not be null."); Site.Assert.IsNotNull(calendar.Calendar.Body, "The Body element should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCAL_R128"); // Verify MS-ASCAL requirement: MS-ASCAL_R128 Site.CaptureRequirementIfIsTrue( newCalendar.Calendar.Body.Type == calendar.Calendar.Body.Type && newCalendar.Calendar.Body.Data == calendar.Calendar.Body.Data, 128, @"[In Body (AirSyncBase Namespace)] The top-level airsyncbase:Body element can be ghosted."); if (!this.IsActiveSyncProtocolVersion121) { Site.Assert.IsNotNull(calendar.Calendar.ResponseRequested, "The ResponseRequested element should not be null."); Site.Assert.IsNotNull(newCalendar.Calendar.ResponseRequested, "The ResponseRequested element should not be null."); Site.Assert.IsNotNull(calendar.Calendar.ResponseType, "The ResponseType element should not be null."); Site.Assert.IsNotNull(newCalendar.Calendar.ResponseType, "The ResponseType element should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCAL_R399"); // Verify MS-ASCAL requirement: MS-ASCAL_R399 Site.CaptureRequirementIfAreEqual<bool>( calendar.Calendar.ResponseRequested.Value, newCalendar.Calendar.ResponseRequested.Value, 399, @"[In ResponseRequested] The ResponseRequested element can be ghosted."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCAL_R419"); // Verify MS-ASCAL requirement: MS-ASCAL_R419 Site.CaptureRequirementIfAreEqual<uint>( calendar.Calendar.ResponseType.Value, newCalendar.Calendar.ResponseType.Value, 419, @"[In ResponseType] The top-level ResponseType element can be ghosted."); } Site.Assert.IsNotNull(calendar.Calendar.MeetingStatus, "The MeetingStatus element should not be null."); Site.Assert.IsNotNull(newCalendar.Calendar.MeetingStatus, "The MeetingStatus element should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCAL_R319"); // Verify MS-ASCAL requirement: MS-ASCAL_R319 Site.CaptureRequirementIfAreEqual<byte>( calendar.Calendar.MeetingStatus.Value, newCalendar.Calendar.MeetingStatus.Value, 319, @"[In MeetingStatus] The top-level MeetingStatus element can be ghosted."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCAL_R365"); // Verify MS-ASCAL requirement: MS-ASCAL_R365 Site.CaptureRequirementIfAreEqual<string>( calendar.Calendar.OrganizerEmail.ToLower(CultureInfo.CurrentCulture), newCalendar.Calendar.OrganizerEmail.ToLower(CultureInfo.CurrentCulture), 365, @"[In OrganizerEmail] The OrganizerEmail element can be ghosted."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCAL_R370"); // Verify MS-ASCAL requirement: MS-ASCAL_R370 Site.CaptureRequirementIfAreEqual<string>( calendar.Calendar.OrganizerName.ToLower(CultureInfo.CurrentCulture), newCalendar.Calendar.OrganizerName.ToLower(CultureInfo.CurrentCulture), 370, @"[In OrganizerName] The OrganizerName element can be ghosted."); // There is only one attendee. Site.Assert.AreEqual<int>( 1, newCalendar.Calendar.Attendees.Attendee.Length, "The Attendees element should be ghosted"); bool isR111Verified = newCalendar.Calendar.Attendees.Attendee[0].AttendeeStatusSpecified == calendar.Calendar.Attendees.Attendee[0].AttendeeStatusSpecified && newCalendar.Calendar.Attendees.Attendee[0].AttendeeStatus == calendar.Calendar.Attendees.Attendee[0].AttendeeStatus && newCalendar.Calendar.Attendees.Attendee[0].AttendeeTypeSpecified == calendar.Calendar.Attendees.Attendee[0].AttendeeTypeSpecified && newCalendar.Calendar.Attendees.Attendee[0].AttendeeType == calendar.Calendar.Attendees.Attendee[0].AttendeeType && newCalendar.Calendar.Attendees.Attendee[0].Email == calendar.Calendar.Attendees.Attendee[0].Email && newCalendar.Calendar.Attendees.Attendee[0].Name == calendar.Calendar.Attendees.Attendee[0].Name; // Add the debug information Site.Log.Add( LogEntryKind.Debug, "Verify MS-ASCAL_R111.\n" + "The AttendeeStatus is {0};\n" + "The AttendeeType is {1};\n" + "The Email is {2};\n" + "The Name is {3}.", newCalendar.Calendar.Attendees.Attendee[0].AttendeeStatus, newCalendar.Calendar.Attendees.Attendee[0].AttendeeType, newCalendar.Calendar.Attendees.Attendee[0].Email, newCalendar.Calendar.Attendees.Attendee[0].Name); // Verify MS-ASCAL requirement: MS-ASCAL_R111 Site.CaptureRequirementIfIsTrue( isR111Verified, 111, @"[In Attendees] The top-level Attendees element can be ghosted."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCAL_R217"); // Verify MS-ASCAL requirement: MS-ASCAL_R217 Site.CaptureRequirementIfAreEqual<bool?>( calendar.Calendar.DisallowNewTimeProposal, newCalendar.Calendar.DisallowNewTimeProposal, 217, @"[In DisallowNewTimeProposal] The DisallowNewTimeProposal element can be ghosted."); if (this.IsActiveSyncProtocolVersion121 || this.IsActiveSyncProtocolVersion140 || this.IsActiveSyncProtocolVersion141) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCAL_R301"); // Verify MS-ASCAL requirement: MS-ASCAL_R301 Site.CaptureRequirementIfIsNull( newCalendar.Calendar.Location, 301, @"[In Location] The top-level Location element cannot be ghosted."); } #endregion }
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 }
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 }