/// <summary> /// Extract Add elements from a Sync string response. /// </summary> /// <param name="sendStringResponse">The returned SendStringResponse object.</param> /// <returns>The extracted SyncStore object.</returns> protected SyncStore ExtractSyncStore(SendStringResponse sendStringResponse) { SyncStore response = new SyncStore(); XmlDocument doc = new XmlDocument(); doc.LoadXml(sendStringResponse.ResponseDataXML); XmlNodeList nodes = doc.DocumentElement.GetElementsByTagName("Collection"); foreach (XmlNode node in nodes) { foreach (XmlNode item in node.ChildNodes) { if (item.Name == "Responses") { foreach (XmlNode add in item) { if (add.Name == "Add") { Response.SyncCollectionsCollectionResponsesAdd responseData = new Response.SyncCollectionsCollectionResponsesAdd(); foreach (XmlNode addItem in add) { if (addItem.Name == "Status") { responseData.Status = addItem.InnerText; } } response.AddResponses.Add(responseData); } } } } } return(response); }
public void MSASTASK_S01_TC16_CreateTaskItemRecurrenceWithoutType() { #region Call Sync command to create a task item without Type element contained in Recurrence. SyncStore initializeSyncResponse = this.TASKAdapter.Sync(Common.CreateInitialSyncRequest(this.UserInformation.TasksCollectionId)); DateTime startTime = DateTime.Now.AddHours(1).AddDays(1); DateTime utcStartTime = startTime.ToUniversalTime(); // Send a string creating task item request without Type element contained in Recurrence. SendStringResponse sendStringResponse = this.TASKAdapter.SendStringRequest("<?xml version=\"1.0\" encoding=\"utf-8\"?><Sync xmlns=\"AirSync\"><Collections><Collection><SyncKey>" + initializeSyncResponse.SyncKey + "</SyncKey><CollectionId>11</CollectionId><DeletesAsMoves>0</DeletesAsMoves><GetChanges>1</GetChanges><WindowSize>512</WindowSize><Options><BodyPreference xmlns=\"AirSyncBase\"><Type>2</Type></BodyPreference></Options><Commands><Add><ClientId>613de0dd-3732-489f-877e-c0f4f0e8eabb</ClientId><ApplicationData><Body xmlns=\"AirSyncBase\"><Type>1</Type><Data>Content of the body.</Data></Body><UtcStartDate xmlns=\"Tasks\">" + utcStartTime.ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + "</UtcStartDate><StartDate xmlns=\"Tasks\">" + startTime.ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + "</StartDate><UtcDueDate xmlns=\"Tasks\">" + utcStartTime.AddHours(5).ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + "</UtcDueDate><DueDate xmlns=\"Tasks\">" + startTime.AddHours(5).ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + "</DueDate><ReminderSet xmlns=\"Tasks\">1</ReminderSet><ReminderTime xmlns=\"Tasks\">" + startTime.AddDays(-1).ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + "</ReminderTime><Subject xmlns=\"Tasks\">MSASTASK_subject_195222_442</Subject><Recurrence xmlns=\"Tasks\"><Start>" + DateTime.Now.AddHours(1).ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + "</Start><DayOfWeek>1</DayOfWeek></Recurrence></ApplicationData></Add></Commands></Collection></Collections></Sync>", CommandName.Sync); // Extract status code from string response SyncStore response = new SyncStore(); XmlDocument doc = new XmlDocument(); doc.LoadXml(sendStringResponse.ResponseDataXML); XmlNodeList nodes = doc.DocumentElement.GetElementsByTagName("Collection"); foreach (XmlNode node in nodes) { foreach (XmlNode item in node.ChildNodes) { if (item.Name == "Responses") { foreach (XmlNode add in item) { if (add.Name == "Add") { Response.SyncCollectionsCollectionResponsesAdd responseData = new Response.SyncCollectionsCollectionResponsesAdd(); foreach (XmlNode addItem in add) { if (addItem.Name == "Status") { responseData.Status = addItem.InnerText; } } response.AddResponses.Add(responseData); } } } } } #endregion // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASTASK_R289"); // Verify MS-ASTASK requirement: MS-ASTASK_R289 Site.CaptureRequirementIfAreEqual<int>( 6, int.Parse(response.AddResponses[0].Status), 289, @"[In Type] If a client does not include this element[Type] in a Sync command request ([MS-ASCMD] section 2.2.2.19) whenever a Recurrence element is present, then the server MUST respond with status error 6."); }
/// <summary> /// Extract Add elements from a Sync string response. /// </summary> /// <param name="sendStringResponse">The returned SendStringResponse object.</param> /// <returns>The extracted SyncStore object.</returns> protected SyncStore ExtractSyncStore(SendStringResponse sendStringResponse) { SyncStore response = new SyncStore(); XmlDocument doc = new XmlDocument(); doc.LoadXml(sendStringResponse.ResponseDataXML); XmlNodeList nodes = doc.DocumentElement.GetElementsByTagName("Collection"); foreach (XmlNode node in nodes) { foreach (XmlNode item in node.ChildNodes) { if (item.Name == "Responses") { foreach (XmlNode add in item) { if (add.Name == "Add") { Response.SyncCollectionsCollectionResponsesAdd responseData = new Response.SyncCollectionsCollectionResponsesAdd(); foreach (XmlNode addItem in add) { if (addItem.Name == "Status") { responseData.Status = addItem.InnerText; } } response.AddResponses.Add(responseData); } } } } } return response; }
/// <summary> /// A method that send out string command request that contains multiple CalendarType elements in Recurrence. /// </summary> /// <param name="type">value of Type element in Recurrence.</param> /// <returns>Command response of sending </returns> public SyncStore AddCalendarWithMultipleCalendarType(string type) { SyncStore initialSyncResponse = this.InitializeSync(this.CurrentUserInformation.CalendarCollectionId, null); SendStringResponse sendStringResponse = new SendStringResponse(); switch (type) { case "2": // [email protected] in string request is a sample email address of an attendee, nothing will be sent to this mailbox. sendStringResponse = this.CALAdapter.SendStringRequest("<?xml version=\"1.0\" encoding=\"utf-8\"?><Sync xmlns=\"AirSync\"><Collections><Collection><SyncKey>" + initialSyncResponse.SyncKey + "</SyncKey><CollectionId>1</CollectionId><WindowSize>512</WindowSize><Options><BodyPreference xmlns=\"AirSyncBase\"><Type>2</Type></BodyPreference></Options><Commands><Add><ClientId>54353</ClientId><ApplicationData><Subject xmlns=\"Calendar\">TestMail</Subject><MeetingStatus xmlns=\"Calendar\">1</MeetingStatus><UID xmlns=\"Calendar\">040000008200E00074C5B7101A82E00800000000B0CD1F52EBBDC901000000000000000010000000B05E442FCB2CA443BF3D99B51A729FE6</UID><Timezone xmlns=\"Calendar\">IP7//ygAVQBUAEMAKwAwADgAOgAwADAAKQAgAEIAZQBpAGoAaQBuAGcALAAgAEMAaABvAG4AZwBxAGkAbgBnACwAIAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAVQBUAEMAKwAwADgAOgAwADAAKQAgAEIAZQBpAGoAaQBuAGcALAAgAEMAaABvAG4AZwBxAGkAbgBnACwAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</Timezone><Attendees xmlns=\"Calendar\"><Attendee><Email>[email protected]</Email><Name>EAS_User02</Name><AttendeeStatus>3</AttendeeStatus><AttendeeType>1</AttendeeType></Attendee></Attendees><Recurrence xmlns=\"Calendar\"><Type>" + type + "</Type><Occurrences>3</Occurrences><Interval>0</Interval><DayOfMonth>1</DayOfMonth><CalendarType>1</CalendarType><CalendarType>2</CalendarType></Recurrence><ResponseRequested xmlns=\"Calendar\">1</ResponseRequested><Reminder xmlns=\"Calendar\">10</Reminder></ApplicationData></Add></Commands></Collection></Collections></Sync>"); break; case "3": // [email protected] in string request is a sample email address of an attendee, nothing will be sent to this mailbox. sendStringResponse = this.CALAdapter.SendStringRequest("<?xml version=\"1.0\" encoding=\"utf-8\"?><Sync xmlns=\"AirSync\"><Collections><Collection><SyncKey>" + initialSyncResponse.SyncKey + "</SyncKey><CollectionId>1</CollectionId><WindowSize>512</WindowSize><Options><BodyPreference xmlns=\"AirSyncBase\"><Type>2</Type></BodyPreference></Options><Commands><Add><ClientId>54353</ClientId><ApplicationData><Subject xmlns=\"Calendar\">TestMail</Subject><MeetingStatus xmlns=\"Calendar\">1</MeetingStatus><UID xmlns=\"Calendar\">040000008200E00074C5B7101A82E00800000000B0CD1F52EBBDC901000000000000000010000000B05E442FCB2CA443BF3D99B51A729FE6</UID><Timezone xmlns=\"Calendar\">IP7//ygAVQBUAEMAKwAwADgAOgAwADAAKQAgAEIAZQBpAGoAaQBuAGcALAAgAEMAaABvAG4AZwBxAGkAbgBnACwAIAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAVQBUAEMAKwAwADgAOgAwADAAKQAgAEIAZQBpAGoAaQBuAGcALAAgAEMAaABvAG4AZwBxAGkAbgBnACwAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</Timezone><Attendees xmlns=\"Calendar\"><Attendee><Email>[email protected]</Email><Name>EAS_User02</Name><AttendeeStatus>3</AttendeeStatus><AttendeeType>1</AttendeeType></Attendee></Attendees><Recurrence xmlns=\"Calendar\"><Type>" + type + "</Type><Occurrences>3</Occurrences><Interval>0</Interval><WeekOfMonth>1</WeekOfMonth><DayOfWeek>1</DayOfWeek><CalendarType>1</CalendarType><CalendarType>2</CalendarType></Recurrence><ResponseRequested xmlns=\"Calendar\">1</ResponseRequested><Reminder xmlns=\"Calendar\">10</Reminder></ApplicationData></Add></Commands></Collection></Collections></Sync>"); break; case "5": // [email protected] in string request is a sample email address of an attendee, nothing will be sent to this mailbox. sendStringResponse = this.CALAdapter.SendStringRequest("<?xml version=\"1.0\" encoding=\"utf-8\"?><Sync xmlns=\"AirSync\"><Collections><Collection><SyncKey>" + initialSyncResponse.SyncKey + "</SyncKey><CollectionId>1</CollectionId><WindowSize>512</WindowSize><Options><BodyPreference xmlns=\"AirSyncBase\"><Type>2</Type></BodyPreference></Options><Commands><Add><ClientId>54353</ClientId><ApplicationData><Subject xmlns=\"Calendar\">TestMail</Subject><MeetingStatus xmlns=\"Calendar\">1</MeetingStatus><UID xmlns=\"Calendar\">040000008200E00074C5B7101A82E00800000000B0CD1F52EBBDC901000000000000000010000000B05E442FCB2CA443BF3D99B51A729FE6</UID><Timezone xmlns=\"Calendar\">IP7//ygAVQBUAEMAKwAwADgAOgAwADAAKQAgAEIAZQBpAGoAaQBuAGcALAAgAEMAaABvAG4AZwBxAGkAbgBnACwAIAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAVQBUAEMAKwAwADgAOgAwADAAKQAgAEIAZQBpAGoAaQBuAGcALAAgAEMAaABvAG4AZwBxAGkAbgBnACwAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</Timezone><Attendees xmlns=\"Calendar\"><Attendee><Email>[email protected]</Email><Name>EAS_User02</Name><AttendeeStatus>3</AttendeeStatus><AttendeeType>1</AttendeeType></Attendee></Attendees><Recurrence xmlns=\"Calendar\"><Type>" + type + "</Type><Occurrences>3</Occurrences><Interval>0</Interval><DayOfMonth>1</DayOfMonth><MonthOfYear>1</MonthOfYear><CalendarType>1</CalendarType><CalendarType>2</CalendarType></Recurrence><ResponseRequested xmlns=\"Calendar\">1</ResponseRequested><Reminder xmlns=\"Calendar\">10</Reminder></ApplicationData></Add></Commands></Collection></Collections></Sync>"); break; case "6": // [email protected] in string request is a sample email address of an attendee, nothing will be sent to this mailbox. sendStringResponse = this.CALAdapter.SendStringRequest("<?xml version=\"1.0\" encoding=\"utf-8\"?><Sync xmlns=\"AirSync\"><Collections><Collection><SyncKey>" + initialSyncResponse.SyncKey + "</SyncKey><CollectionId>1</CollectionId><WindowSize>512</WindowSize><Options><BodyPreference xmlns=\"AirSyncBase\"><Type>2</Type></BodyPreference></Options><Commands><Add><ClientId>54353</ClientId><ApplicationData><Subject xmlns=\"Calendar\">TestMail</Subject><MeetingStatus xmlns=\"Calendar\">1</MeetingStatus><UID xmlns=\"Calendar\">040000008200E00074C5B7101A82E00800000000B0CD1F52EBBDC901000000000000000010000000B05E442FCB2CA443BF3D99B51A729FE6</UID><Timezone xmlns=\"Calendar\">IP7//ygAVQBUAEMAKwAwADgAOgAwADAAKQAgAEIAZQBpAGoAaQBuAGcALAAgAEMAaABvAG4AZwBxAGkAbgBnACwAIAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAVQBUAEMAKwAwADgAOgAwADAAKQAgAEIAZQBpAGoAaQBuAGcALAAgAEMAaABvAG4AZwBxAGkAbgBnACwAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</Timezone><Attendees xmlns=\"Calendar\"><Attendee><Email>[email protected]</Email><Name>EAS_User02</Name><AttendeeStatus>3</AttendeeStatus><AttendeeType>1</AttendeeType></Attendee></Attendees><Recurrence xmlns=\"Calendar\"><Type>" + type + "</Type><Occurrences>3</Occurrences><Interval>0</Interval><WeekOfMonth>1</WeekOfMonth><MonthOfYear>1</MonthOfYear><CalendarType>1</CalendarType><CalendarType>2</CalendarType></Recurrence><ResponseRequested xmlns=\"Calendar\">1</ResponseRequested><Reminder xmlns=\"Calendar\">10</Reminder></ApplicationData></Add></Commands></Collection></Collections></Sync>"); break; } SyncStore response = new SyncStore(); XmlDocument doc = new XmlDocument(); doc.LoadXml(sendStringResponse.ResponseDataXML); XmlNodeList nodes = doc.DocumentElement.GetElementsByTagName("Collection"); foreach (XmlNode node in nodes) { foreach (XmlNode item in node.ChildNodes) { if (item.Name == "SyncKey") { response.SyncKey = item.InnerText; } if (item.Name == "CollectionId") { response.CollectionId = item.InnerText; } if (item.Name == "Status") { response.CollectionStatus = byte.Parse(item.InnerText); } if (item.Name == "Responses") { foreach (XmlNode add in item) { if (add.Name == "Add") { Response.SyncCollectionsCollectionResponsesAdd res = new Response.SyncCollectionsCollectionResponsesAdd(); foreach (XmlNode additem in add) { if (additem.Name == "ClientId") { res.ClientId = additem.InnerText; } if (additem.Name == "ServerId") { res.ServerId = additem.InnerText; } if (additem.Name == "Status") { res.Status = additem.InnerText; } } response.AddResponses.Add(res); } } } } } return(response); }
public void MSASNOTE_S01_TC03_Sync_LastModifiedDateIgnored() { #region Call method Sync to add a note to the server Dictionary <Request.ItemsChoiceType8, object> addElements = this.CreateNoteElements(); string lastModifiedDate = DateTime.UtcNow.ToString("yyyyMMddTHHmmssZ", CultureInfo.InvariantCulture); addElements.Add(Request.ItemsChoiceType8.LastModifiedDate, lastModifiedDate); System.Threading.Thread.Sleep(1000); SyncStore addResult = this.SyncAdd(addElements, 1); Response.SyncCollectionsCollectionResponsesAdd item = addResult.AddResponses[0]; #endregion #region Call method Sync to synchronize the note item with the server. SyncStore result = this.SyncChanges(1); Note note = null; for (int i = 0; i < result.AddElements.Count; i++) { if (addResult.AddElements != null && addResult.AddElements.Count > 0) { if (result.AddElements[i].ServerId.Equals(addResult.AddElements[0].ServerId)) { note = result.AddElements[i].Note; break; } } else if (addResult.AddResponses != null && addResult.AddResponses.Count > 0) { if (result.AddElements[i].ServerId.Equals(addResult.AddResponses[0].ServerId)) { note = result.AddElements[i].Note; break; } } } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASNOTE_R84"); // Verify MS-ASNOTE requirement: MS-ASNOTE_R84 Site.CaptureRequirementIfAreNotEqual <string>( lastModifiedDate, note.LastModifiedDate.ToString("yyyyMMddTHHmmssZ", CultureInfo.InvariantCulture), 84, @"[In LastModifiedDate Element] If it is included in a Sync command request, the server will ignore it."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASNOTE_R209"); // Verify MS-ASNOTE requirement: MS-ASNOTE_R209 // this requirement can be captured directly after MS-ASNOTE_R84. Site.CaptureRequirement( 209, @"[In LastModifiedDate Element] If a Sync command request includes the LastModifiedDate element, the server ignores the element and returns the actual time that the note was last modified."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASNOTE_R126"); bool isVerifiedR126 = note.Body != null && note.Subject != null && note.MessageClass != null && note.IsLastModifiedDateSpecified && note.Categories != null && note.Categories.Category != null; // Verify MS-ASNOTE requirement: MS-ASNOTE_R126 Site.CaptureRequirementIfIsTrue( isVerifiedR126, 126, @"[In Sync Command Response] Any of the elements for the Notes class[airsyncbase:Body, Subject, MessageClass, LastModifiedDate, Categories or Category], as specified in section 2.2.2, can be included in a Sync command response as child elements of the airsync:ApplicationData element ([MS-ASCMD] section 2.2.3.11) within [either] an airsync:Add element ([MS-ASCMD] section 2.2.3.7.2) [or an airsync:Change element ([MS-ASCMD] section 2.2.3.24)]."); #endregion #region Call method Sync to only change the note's LastModifiedDate element, the server will ignore the change, and the note item should be unchanged. // changeElements: Change the note's LastModifiedDate by replacing its LastModifiedDate with a new LastModifiedDate. Dictionary <Request.ItemsChoiceType7, object> changeElements = new Dictionary <Request.ItemsChoiceType7, object>(); lastModifiedDate = DateTime.UtcNow.ToString("yyyyMMddTHHmmssZ", CultureInfo.InvariantCulture); changeElements.Add(Request.ItemsChoiceType7.LastModifiedDate, lastModifiedDate); this.SyncChange(result.SyncKey, item.ServerId, changeElements); #endregion #region Call method Sync to synchronize the changes with the server. SyncStore result2 = this.SyncChanges(result.SyncKey, 1); bool isNoteFound; if (result2.ChangeElements != null) { isNoteFound = TestSuiteHelper.CheckSyncChangeCommands(result, addElements[Request.ItemsChoiceType8.Subject1].ToString(), this.Site); Site.Assert.IsFalse(isNoteFound, "The note with subject:{0} should not be returned in Sync command response.", addElements[Request.ItemsChoiceType8.Subject1].ToString()); } else { Site.Log.Add(LogEntryKind.Debug, @"The Change elements are null."); } #endregion #region Call method Sync to change the note's LastModifiedDate and subject. // changeElements: Change the note's LastModifiedDate by replacing its LastModifiedDate with a new LastModifiedDate. // changeElements: Change the note's subject by replacing its subject with a new subject. changeElements = new Dictionary <Request.ItemsChoiceType7, object>(); lastModifiedDate = DateTime.UtcNow.ToString("yyyyMMddTHHmmssZ", CultureInfo.InvariantCulture); changeElements.Add(Request.ItemsChoiceType7.LastModifiedDate, lastModifiedDate); string changedSubject = Common.GenerateResourceName(Site, "subject"); changeElements.Add(Request.ItemsChoiceType7.Subject1, changedSubject); changeElements = TestSuiteHelper.CombineChangeAndAddNoteElements(addElements, changeElements); this.SyncChange(result.SyncKey, item.ServerId, changeElements); #endregion #region Call method Sync to synchronize the note item with the server. result = this.SyncChanges(result.SyncKey, 1); isNoteFound = TestSuiteHelper.CheckSyncChangeCommands(result, changeElements[Request.ItemsChoiceType7.Subject1].ToString(), this.Site); Site.Assert.IsTrue(isNoteFound, "The note with subject:{0} should be returned in Sync command response.", changeElements[Request.ItemsChoiceType7.Subject1].ToString()); // The subject of the note is updated. this.ExistingNoteSubjects.Remove(addElements[Request.ItemsChoiceType8.Subject1].ToString()); this.ExistingNoteSubjects.Add(changeElements[Request.ItemsChoiceType7.Subject1].ToString()); note = result.ChangeElements[0].Note; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASNOTE_R210"); bool isVerifiedR210 = note.Body != null && note.Subject != null && note.MessageClass != null && note.IsLastModifiedDateSpecified && note.Categories != null && note.Categories.Category != null; // Verify MS-ASNOTE requirement: MS-ASNOTE_R210 Site.CaptureRequirementIfIsTrue( isVerifiedR210, 210, @"[In Sync Command Response] Any of the elements for the Notes class[airsyncbase:Body, Subject, MessageClass, LastModifiedDate, Categories or Category], as specified in section 2.2.2, can be included in a Sync command response as child elements of the airsync:ApplicationData element ([MS-ASCMD] section 2.2.3.11) within [either an airsync:Add element ([MS-ASCMD] section 2.2.3.7.2) or] an airsync:Change element ([MS-ASCMD] section 2.2.3.24)."); Site.Assert.AreEqual <string>( changeElements[Request.ItemsChoiceType7.Subject1].ToString(), note.Subject, "The subject element in Change Command response should be the same with the changed value of subject in Change Command request."); #endregion }
public void MSASNOTE_S01_TC02_Sync_ChangeNote_WithoutBodyInRequest() { #region Call method Sync to add a note to the server Dictionary <Request.ItemsChoiceType8, object> addElements = this.CreateNoteElements(); addElements[Request.ItemsChoiceType8.Categories2] = new Request.Categories3(); SyncStore addResult = this.SyncAdd(addElements, 1); Response.SyncCollectionsCollectionResponsesAdd item = addResult.AddResponses[0]; #endregion #region Call method Sync to change the note's Subject and MessageClass elements. // changeElements:Change the note's subject by replacing its subject with a new subject. Dictionary <Request.ItemsChoiceType7, object> changeElements = new Dictionary <Request.ItemsChoiceType7, object>(); string changedSubject = Common.GenerateResourceName(Site, "subject"); changeElements.Add(Request.ItemsChoiceType7.Subject1, changedSubject); // changeElements:Change the note's MessageClass by replacing its MessageClass with a new MessageClass. changeElements.Add(Request.ItemsChoiceType7.MessageClass, "IPM.StickyNote.MSASNOTE"); changeElements = TestSuiteHelper.CombineChangeAndAddNoteElements(addElements, changeElements); // changeElements:Remove the note's Body in change command changeElements.Remove(Request.ItemsChoiceType7.Body); SyncStore changeResult = this.SyncChange(addResult.SyncKey, item.ServerId, changeElements); Site.Assert.AreEqual <byte>( 1, changeResult.CollectionStatus, "The server should return a Status 1 in the Sync command response indicate sync command succeed."); // The subject of the note is updated. this.ExistingNoteSubjects.Remove(addElements[Request.ItemsChoiceType8.Subject1].ToString()); this.ExistingNoteSubjects.Add(changeElements[Request.ItemsChoiceType7.Subject1].ToString()); #endregion #region Call method Sync to synchronize the note item with the server. // Synchronize the changes with server SyncStore result = this.SyncChanges(addResult.SyncKey, 1); bool isNoteFound = TestSuiteHelper.CheckSyncChangeCommands(result, changeElements[Request.ItemsChoiceType7.Subject1].ToString(), this.Site); Site.Assert.IsTrue(isNoteFound, "The note with subject:{0} should be returned in Sync command response.", changeElements[Request.ItemsChoiceType7.Subject1].ToString()); Note note = result.ChangeElements[0].Note; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASNOTE_R113"); // Verify MS-ASNOTE requirement: MS-ASNOTE_R113 Site.CaptureRequirementIfIsNotNull( note.Body, 113, @"[In Sync Command Response] The absence of an airsyncbase:Body element (section 2.2.2.1) within an airsync:Change element is not to be interpreted as an implicit delete."); Site.Assert.AreEqual <string>( changeElements[Request.ItemsChoiceType7.Subject1].ToString(), note.Subject, "The subject element in Change Command response should be the same with the changed value of subject in Change Command request."); Site.Assert.AreEqual <string>( changeElements[Request.ItemsChoiceType7.MessageClass].ToString(), note.MessageClass, "The MessageClass element in Change Command response should be the same with the changed value of MessageClass in Change Command request."); #endregion }
/// <summary> /// A method that send out string command request that contains multiple CalendarType elements in Recurrence. /// </summary> /// <param name="type">value of Type element in Recurrence.</param> /// <returns>Command response of sending </returns> public SyncStore AddCalendarWithMultipleCalendarType(string type) { SyncStore initialSyncResponse = this.InitializeSync(this.CurrentUserInformation.CalendarCollectionId, null); SendStringResponse sendStringResponse = new SendStringResponse(); switch (type) { case "2": // [email protected] in string request is a sample email address of an attendee, nothing will be sent to this mailbox. sendStringResponse = this.CALAdapter.SendStringRequest("<?xml version=\"1.0\" encoding=\"utf-8\"?><Sync xmlns=\"AirSync\"><Collections><Collection><SyncKey>" + initialSyncResponse.SyncKey + "</SyncKey><CollectionId>1</CollectionId><WindowSize>512</WindowSize><Options><BodyPreference xmlns=\"AirSyncBase\"><Type>2</Type></BodyPreference></Options><Commands><Add><ClientId>54353</ClientId><ApplicationData><Subject xmlns=\"Calendar\">TestMail</Subject><MeetingStatus xmlns=\"Calendar\">1</MeetingStatus><UID xmlns=\"Calendar\">040000008200E00074C5B7101A82E00800000000B0CD1F52EBBDC901000000000000000010000000B05E442FCB2CA443BF3D99B51A729FE6</UID><Timezone xmlns=\"Calendar\">IP7//ygAVQBUAEMAKwAwADgAOgAwADAAKQAgAEIAZQBpAGoAaQBuAGcALAAgAEMAaABvAG4AZwBxAGkAbgBnACwAIAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAVQBUAEMAKwAwADgAOgAwADAAKQAgAEIAZQBpAGoAaQBuAGcALAAgAEMAaABvAG4AZwBxAGkAbgBnACwAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</Timezone><Attendees xmlns=\"Calendar\"><Attendee><Email>[email protected]</Email><Name>EAS_User02</Name><AttendeeStatus>3</AttendeeStatus><AttendeeType>1</AttendeeType></Attendee></Attendees><Recurrence xmlns=\"Calendar\"><Type>" + type + "</Type><Occurrences>3</Occurrences><Interval>0</Interval><DayOfMonth>1</DayOfMonth><CalendarType>1</CalendarType><CalendarType>2</CalendarType></Recurrence><ResponseRequested xmlns=\"Calendar\">1</ResponseRequested><Reminder xmlns=\"Calendar\">10</Reminder></ApplicationData></Add></Commands></Collection></Collections></Sync>"); break; case "3": // [email protected] in string request is a sample email address of an attendee, nothing will be sent to this mailbox. sendStringResponse = this.CALAdapter.SendStringRequest("<?xml version=\"1.0\" encoding=\"utf-8\"?><Sync xmlns=\"AirSync\"><Collections><Collection><SyncKey>" + initialSyncResponse.SyncKey + "</SyncKey><CollectionId>1</CollectionId><WindowSize>512</WindowSize><Options><BodyPreference xmlns=\"AirSyncBase\"><Type>2</Type></BodyPreference></Options><Commands><Add><ClientId>54353</ClientId><ApplicationData><Subject xmlns=\"Calendar\">TestMail</Subject><MeetingStatus xmlns=\"Calendar\">1</MeetingStatus><UID xmlns=\"Calendar\">040000008200E00074C5B7101A82E00800000000B0CD1F52EBBDC901000000000000000010000000B05E442FCB2CA443BF3D99B51A729FE6</UID><Timezone xmlns=\"Calendar\">IP7//ygAVQBUAEMAKwAwADgAOgAwADAAKQAgAEIAZQBpAGoAaQBuAGcALAAgAEMAaABvAG4AZwBxAGkAbgBnACwAIAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAVQBUAEMAKwAwADgAOgAwADAAKQAgAEIAZQBpAGoAaQBuAGcALAAgAEMAaABvAG4AZwBxAGkAbgBnACwAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</Timezone><Attendees xmlns=\"Calendar\"><Attendee><Email>[email protected]</Email><Name>EAS_User02</Name><AttendeeStatus>3</AttendeeStatus><AttendeeType>1</AttendeeType></Attendee></Attendees><Recurrence xmlns=\"Calendar\"><Type>" + type + "</Type><Occurrences>3</Occurrences><Interval>0</Interval><WeekOfMonth>1</WeekOfMonth><DayOfWeek>1</DayOfWeek><CalendarType>1</CalendarType><CalendarType>2</CalendarType></Recurrence><ResponseRequested xmlns=\"Calendar\">1</ResponseRequested><Reminder xmlns=\"Calendar\">10</Reminder></ApplicationData></Add></Commands></Collection></Collections></Sync>"); break; case "5": // [email protected] in string request is a sample email address of an attendee, nothing will be sent to this mailbox. sendStringResponse = this.CALAdapter.SendStringRequest("<?xml version=\"1.0\" encoding=\"utf-8\"?><Sync xmlns=\"AirSync\"><Collections><Collection><SyncKey>" + initialSyncResponse.SyncKey + "</SyncKey><CollectionId>1</CollectionId><WindowSize>512</WindowSize><Options><BodyPreference xmlns=\"AirSyncBase\"><Type>2</Type></BodyPreference></Options><Commands><Add><ClientId>54353</ClientId><ApplicationData><Subject xmlns=\"Calendar\">TestMail</Subject><MeetingStatus xmlns=\"Calendar\">1</MeetingStatus><UID xmlns=\"Calendar\">040000008200E00074C5B7101A82E00800000000B0CD1F52EBBDC901000000000000000010000000B05E442FCB2CA443BF3D99B51A729FE6</UID><Timezone xmlns=\"Calendar\">IP7//ygAVQBUAEMAKwAwADgAOgAwADAAKQAgAEIAZQBpAGoAaQBuAGcALAAgAEMAaABvAG4AZwBxAGkAbgBnACwAIAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAVQBUAEMAKwAwADgAOgAwADAAKQAgAEIAZQBpAGoAaQBuAGcALAAgAEMAaABvAG4AZwBxAGkAbgBnACwAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</Timezone><Attendees xmlns=\"Calendar\"><Attendee><Email>[email protected]</Email><Name>EAS_User02</Name><AttendeeStatus>3</AttendeeStatus><AttendeeType>1</AttendeeType></Attendee></Attendees><Recurrence xmlns=\"Calendar\"><Type>" + type + "</Type><Occurrences>3</Occurrences><Interval>0</Interval><DayOfMonth>1</DayOfMonth><MonthOfYear>1</MonthOfYear><CalendarType>1</CalendarType><CalendarType>2</CalendarType></Recurrence><ResponseRequested xmlns=\"Calendar\">1</ResponseRequested><Reminder xmlns=\"Calendar\">10</Reminder></ApplicationData></Add></Commands></Collection></Collections></Sync>"); break; case "6": // [email protected] in string request is a sample email address of an attendee, nothing will be sent to this mailbox. sendStringResponse = this.CALAdapter.SendStringRequest("<?xml version=\"1.0\" encoding=\"utf-8\"?><Sync xmlns=\"AirSync\"><Collections><Collection><SyncKey>" + initialSyncResponse.SyncKey + "</SyncKey><CollectionId>1</CollectionId><WindowSize>512</WindowSize><Options><BodyPreference xmlns=\"AirSyncBase\"><Type>2</Type></BodyPreference></Options><Commands><Add><ClientId>54353</ClientId><ApplicationData><Subject xmlns=\"Calendar\">TestMail</Subject><MeetingStatus xmlns=\"Calendar\">1</MeetingStatus><UID xmlns=\"Calendar\">040000008200E00074C5B7101A82E00800000000B0CD1F52EBBDC901000000000000000010000000B05E442FCB2CA443BF3D99B51A729FE6</UID><Timezone xmlns=\"Calendar\">IP7//ygAVQBUAEMAKwAwADgAOgAwADAAKQAgAEIAZQBpAGoAaQBuAGcALAAgAEMAaABvAG4AZwBxAGkAbgBnACwAIAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAVQBUAEMAKwAwADgAOgAwADAAKQAgAEIAZQBpAGoAaQBuAGcALAAgAEMAaABvAG4AZwBxAGkAbgBnACwAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</Timezone><Attendees xmlns=\"Calendar\"><Attendee><Email>[email protected]</Email><Name>EAS_User02</Name><AttendeeStatus>3</AttendeeStatus><AttendeeType>1</AttendeeType></Attendee></Attendees><Recurrence xmlns=\"Calendar\"><Type>" + type + "</Type><Occurrences>3</Occurrences><Interval>0</Interval><WeekOfMonth>1</WeekOfMonth><MonthOfYear>1</MonthOfYear><CalendarType>1</CalendarType><CalendarType>2</CalendarType></Recurrence><ResponseRequested xmlns=\"Calendar\">1</ResponseRequested><Reminder xmlns=\"Calendar\">10</Reminder></ApplicationData></Add></Commands></Collection></Collections></Sync>"); break; } SyncStore response = new SyncStore(); XmlDocument doc = new XmlDocument(); doc.LoadXml(sendStringResponse.ResponseDataXML); XmlNodeList nodes = doc.DocumentElement.GetElementsByTagName("Collection"); foreach (XmlNode node in nodes) { foreach (XmlNode item in node.ChildNodes) { if (item.Name == "SyncKey") { response.SyncKey = item.InnerText; } if (item.Name == "CollectionId") { response.CollectionId = item.InnerText; } if (item.Name == "Status") { response.CollectionStatus = byte.Parse(item.InnerText); } if (item.Name == "Responses") { foreach (XmlNode add in item) { if (add.Name == "Add") { Response.SyncCollectionsCollectionResponsesAdd res = new Response.SyncCollectionsCollectionResponsesAdd(); foreach (XmlNode additem in add) { if (additem.Name == "ClientId") { res.ClientId = additem.InnerText; } if (additem.Name == "ServerId") { res.ServerId = additem.InnerText; } if (additem.Name == "Status") { res.Status = additem.InnerText; } } response.AddResponses.Add(res); } } } } } return response; }