public void MSOUTSPS_S02_TC36_TriggerExceptionDeletion_UpdateRecurrenceData() { string listId = this.AddListToSUT(TemplateType.Events); #region Add one recurrence item List<MethodCmdEnum> cmds = new List<MethodCmdEnum>(1); cmds.Add(MethodCmdEnum.New); // Setting recurring setting DateTime eventDateOfRecurrence = DateTime.Today.Date.AddDays(1); string eventTitle = this.GetUniqueListItemTitle("DailyRecurrenceEvent"); Dictionary<string, string> settingsOfDailyRecurring = this.GetDailyRecurrenceSettingWithwindowEnd(eventTitle, eventDateOfRecurrence, "1", 10); List<Dictionary<string, string>> addedItemsOfRecurrence = new List<Dictionary<string, string>>(); addedItemsOfRecurrence.Add(settingsOfDailyRecurring); // add a recurrence appointment item whose duration is 10 days, and each instance of this recurrence item will be repeat on "Daily". There should be 10 instances of this item. UpdateListItemsUpdates updatesOfRecurrence = this.CreateUpdateListItems(cmds, addedItemsOfRecurrence, OnErrorEnum.Continue); UpdateListItemsResponseUpdateListItemsResult updateResult = OutspsAdapter.UpdateListItems(listId, updatesOfRecurrence); // Get list item id from the response of UpdateListItems operation. this.VerifyResponseOfUpdateListItem(updateResult); List<string> addedRecurrenceItemIds = this.GetListItemIdsFromUpdateListItemsResponse(updateResult, 1); XmlNode[] zrowItemsOfRecurrenceAppointment = this.GetZrowItems(updateResult.Results[0].Any); // Validate the RecurrenceData Field string updatedRecurrenceDataValue = Common.GetZrowAttributeValue(zrowItemsOfRecurrenceAppointment, 0, "ows_RecurrenceData"); this.VerifyComplexTypesSchema(updatedRecurrenceDataValue, typeof(RecurrenceXML)); #endregion Add one recurrence item #region Add exception item // add an exception appointment item whose event day is different from recurrence item. DateTime exceptionEventDate = eventDateOfRecurrence.AddDays(1).AddHours(2); // The second recurrence instance will be replaced by exception item. DateTime overwrittenRecerrenceEventDate = eventDateOfRecurrence.AddDays(1); // Get the recurrence item id. string recurrenceItemId = addedRecurrenceItemIds[0]; // Set the exception item setting. string exceptionItemTitle = this.GetUniqueListItemTitle("ExceptionItem"); Dictionary<string, string> settingsOfException = this.GetExceptionsItemSettingForRecurrenceEvent( exceptionEventDate, overwrittenRecerrenceEventDate, exceptionItemTitle, recurrenceItemId, settingsOfDailyRecurring); List<Dictionary<string, string>> addeditemsOfException = new List<Dictionary<string, string>>(); addeditemsOfException.Add(settingsOfException); UpdateListItemsUpdates updatesOfException = this.CreateUpdateListItems(cmds, addeditemsOfException, OnErrorEnum.Continue); UpdateListItemsResponseUpdateListItemsResult updateResultOfException = OutspsAdapter.UpdateListItems(listId, updatesOfException); // Get the exception item Id, and only add 1 exception item in this UpdateListItems call. List<string> exceptionItemIds = this.GetListItemIdsFromUpdateListItemsResponse(updateResultOfException, 1); #endregion Add exception item #region Update the RecurrenData field to trigger exception deletion. // Update the RecurrenceData field and append the deleteExceptions element. RecurrenceXML recurrenceXMLData = new RecurrenceXML(); // recurrenceXMLData.deleteExceptions = null; recurrenceXMLData.recurrence = new RecurrenceDefinition(); recurrenceXMLData.recurrence.rule = new RecurrenceRule(); recurrenceXMLData.recurrence.rule.firstDayOfWeek = DayOfWeekOrMonth.mo; // Set the windowEnd value, the recurrence will be end on one month later, and the repeat frequency is weekly. DateTime winEndDate = eventDateOfRecurrence.Date.AddDays(30); recurrenceXMLData.recurrence.rule.Item = winEndDate; // Repeat Pattern, set it as weekly repeat. recurrenceXMLData.recurrence.rule.repeat = new RepeatPattern(); // Setting the WeeklyFrequencyValue RepeatPatternWeekly repeatPatternWeeklyData = new RepeatPatternWeekly(); repeatPatternWeeklyData.weekFrequency = "1"; repeatPatternWeeklyData.mo = TrueFalseDOW.TRUE; repeatPatternWeeklyData.moSpecified = true; recurrenceXMLData.recurrence.rule.repeat.Item = repeatPatternWeeklyData; // Update the RecurrenData field string recurrenceXMLString = this.GetRecurrenceXMLString(recurrenceXMLData); settingsOfDailyRecurring["RecurrenceData"] = recurrenceXMLString; List<MethodCmdEnum> updateRecurrencecmds = new List<MethodCmdEnum>(1); updateRecurrencecmds.Add(MethodCmdEnum.Update); // Set target update list item settingsOfDailyRecurring.Add("ID", recurrenceItemId); // Update the recurrence item with updated RecurrenceData field value. List<Dictionary<string, string>> updatedRecurrenceSettings = new List<Dictionary<string, string>>(); updatedRecurrenceSettings.Add(settingsOfDailyRecurring); UpdateListItemsUpdates updatesOfDeletion = this.CreateUpdateListItems(updateRecurrencecmds, updatedRecurrenceSettings, OnErrorEnum.Continue); UpdateListItemsResponseUpdateListItemsResult updateResultOfTriggerExceptionDeletion = OutspsAdapter.UpdateListItems(listId, updatesOfDeletion); this.VerifyResponseOfUpdateListItem(updateResultOfTriggerExceptionDeletion); #endregion Update the RecurrenData field to trigger exception deletion. XmlNode[] zrowItemsOfGetListItemChangesSinceToken = this.GetListItemsChangesFromSUT(listId); // If the exception item data does not present in zrow items array in response of GetListItemChangesSinceToken, then capture R445023, R900 int zrowIndexOfExceptionItem = this.TryGetZrowItemIndexByListItemId(zrowItemsOfGetListItemChangesSinceToken, exceptionItemIds[0]); if (Common.IsRequirementEnabled(445023, this.Site)) { this.Site.Assert.AreEqual<int>( -1, zrowIndexOfExceptionItem, "The exception item data should absent in zrow items array in response of GetListItemChangesSinceToken"); // Verify MS-OUTSPS requirement: MS-OUTSPS_R445023 this.Site.CaptureRequirement( 445023, @"[In Appendix B: Product Behavior] Implementation does trigger exception deletion when RecurrenceData is updated.(<27>Windows SharePoint Services3.0 and above does delete exception items when these properties are updated.)"); } this.Site.Assert.AreEqual<int>( -1, zrowIndexOfExceptionItem, "The exception item data should absent in zrow items array in response of GetListItemChangesSinceToken"); // Verify MS-OUTSPS requirement: MS-OUTSPS_R900 this.Site.CaptureRequirement( 900, @"[In RecurrenceXML complex type]deleteExceptions: This element MUST be present if and only if RecurrenceXML is written by a protocol client in UpdateListItems (section 3.1.4.10) and the protocol client requests that the protocol server delete all exception items for this recurrence. See section 3.2.1.1 for details about exception items and recurrences."); }
public void MSOUTSPS_S02_TC27_RecurrenceAppointmentItem_TrueFalseDOWSimleType() { string listId = this.AddListToSUT(TemplateType.Events); // Setting recurring setting DateTime eventDateOfRecurrence = DateTime.Today.Date.AddDays(1); Dictionary<string, string> settingsOfDailyRecurring = this.GetDailyRecurrenceSettingWithwindowEnd(this.GetUniqueListItemTitle("WeeklyRecurrence"), eventDateOfRecurrence, "1", 10); // Setting common recurrenceXMLData setting RecurrenceXML recurrenceXMLData = new RecurrenceXML(); recurrenceXMLData.deleteExceptions = null; recurrenceXMLData.recurrence = new RecurrenceDefinition(); recurrenceXMLData.recurrence.rule = new RecurrenceRule(); recurrenceXMLData.recurrence.rule.firstDayOfWeek = DayOfWeekOrMonth.mo; // Set the windowEnd value, the recurrence will be end on one month later, and the repeat frequency is weekly. DateTime winEndDate = eventDateOfRecurrence.Date.AddMonths(1); recurrenceXMLData.recurrence.rule.Item = winEndDate; // Repeat Pattern, set it as weekly repeat. recurrenceXMLData.recurrence.rule.repeat = new RepeatPattern(); // Setting the monthFrequency. every month repeat. RepeatPatternWeekly repeatPatternWeekly = new RepeatPatternWeekly(); repeatPatternWeekly.weekFrequency = "1"; // Set TrueFalseDOW.True repeatPatternWeekly.mo = TrueFalseDOW.TRUE; repeatPatternWeekly.moSpecified = true; // Set TrueFalseDOW.FALSE repeatPatternWeekly.tu = TrueFalseDOW.FALSE; repeatPatternWeekly.tuSpecified = true; // Set TrueFalseDOW.@true repeatPatternWeekly.we = TrueFalseDOW.@true; repeatPatternWeekly.weSpecified = true; // Set TrueFalseDOW.@false repeatPatternWeekly.th = TrueFalseDOW.@false; repeatPatternWeekly.thSpecified = true; recurrenceXMLData.recurrence.rule.repeat.Item = repeatPatternWeekly; string recurrenceXMLString = this.GetRecurrenceXMLString(recurrenceXMLData); this.Site.Assert.IsTrue( settingsOfDailyRecurring.ContainsKey("RecurrenceData"), "The fields setting should contain RecurrenceData field setting."); settingsOfDailyRecurring["RecurrenceData"] = recurrenceXMLString; List<Dictionary<string, string>> addedItemsOfRecurrence = new List<Dictionary<string, string>>(); List<MethodCmdEnum> cmds = new List<MethodCmdEnum>(); addedItemsOfRecurrence.Add(settingsOfDailyRecurring); cmds.Add(MethodCmdEnum.New); // Add list item with specified TrueFalseDOW values UpdateListItemsUpdates updatesOfRecurrence = this.CreateUpdateListItems(cmds, addedItemsOfRecurrence, OnErrorEnum.Continue); UpdateListItemsResponseUpdateListItemsResult updateResult = OutspsAdapter.UpdateListItems(listId, updatesOfRecurrence); // Get the listItem id and the related RecurrenceData this.VerifyResponseOfUpdateListItem(updateResult); List<string> addedRecurrenceItemIds = this.GetListItemIdsFromUpdateListItemsResponse(updateResult, 1); XmlNode[] zrowItems = this.GetListItemsChangesFromSUT(listId); int zrowIndexOfAddedItem = this.GetZrowItemIndexByListItemId(zrowItems, addedRecurrenceItemIds[0]); string actualRecurrenceData = Common.GetZrowAttributeValue(zrowItems, zrowIndexOfAddedItem, "ows_RecurrenceData"); // If the actual RecurrenceData field value is equal to the value set in the request, then capture R1041, R1042, R1043, R1044 this.Site.Assert.AreEqual<string>( recurrenceXMLString.ToLower(), actualRecurrenceData.ToLower(), "The actual RecurrenceData field value is equal to the value set in the request of UpdateListItems operation."); // Verify MS-OUTSPS requirement: MS-OUTSPS_R1041 this.Site.CaptureRequirement( 1041, @"[TrueFalseDOW][The enumeration value]TRUE[of the type TrueFalseDOW means]true"); // Verify MS-OUTSPS requirement: MS-OUTSPS_R1042 this.Site.CaptureRequirement( 1042, @"[TrueFalseDOW][The enumeration value]FALSE[of the type TrueFalseDOW means]false"); // Verify MS-OUTSPS requirement: MS-OUTSPS_R1043 this.Site.CaptureRequirement( 1043, @"[TrueFalseDOW][The enumeration value]true[of the type TrueFalseDOW means]true"); // Verify MS-OUTSPS requirement: MS-OUTSPS_R1044 this.Site.CaptureRequirement( 1044, @"[TrueFalseDOW][The enumeration value]false[of the type TrueFalseDOW means]false"); }