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_TC01_OperationListItemsForAppointment()
        {
            string listId = this.AddListToSUT(TemplateType.Events);

            Dictionary<string, string> recurEventFieldsSetting = new Dictionary<string, string>();
            DateTime eventDate = DateTime.Today.Date.AddDays(1);
            DateTime endDate = eventDate.AddHours(1);
            string eventDateValue = this.GetGeneralFormatTimeString(eventDate);
            string endDateValue = this.GetGeneralFormatTimeString(endDate);
            string eventTitle = this.GetUniqueListItemTitle("RecurrenceEvent");

            // Recurring data
            RecurrenceXML recurrenceXMLData = new RecurrenceXML();
            recurrenceXMLData.deleteExceptions = null;
            recurrenceXMLData.recurrence = new RecurrenceDefinition();
            recurrenceXMLData.recurrence.rule = new RecurrenceRule();
            recurrenceXMLData.recurrence.rule.firstDayOfWeek = DayOfWeekOrMonth.su;

            // Repeat Pattern
            recurrenceXMLData.recurrence.rule.repeat = new RepeatPattern();
            RepeatPatternDaily repeatPatternDailyData = new RepeatPatternDaily();

            // Setting the dayFrequencyValue
            repeatPatternDailyData.dayFrequency = "1";
            recurrenceXMLData.recurrence.rule.repeat.Item = repeatPatternDailyData;
            recurrenceXMLData.recurrence.rule.Item = "7";
            string recurrenceXmlString = this.GetRecurrenceXMLString(recurrenceXMLData);

            // Setting necessary fields' value
            recurEventFieldsSetting.Add("EventDate", eventDateValue);

            // The ending date and time of the appointment.
            recurEventFieldsSetting.Add("EndDate", endDateValue);

            // If the EventType indicates a recurring event, then fRecurrence MUST be "1". 
            recurEventFieldsSetting.Add("EventType", "1");

            // "0" means this is not an all-day event.
            recurEventFieldsSetting.Add("fAllDayEvent", "0");

            // "1" means this is a recurrence event.
            recurEventFieldsSetting.Add("fRecurrence", "1");

            // If EventType is "1", this property MUST contain a valid RecurrenceXML.
            recurEventFieldsSetting.Add("RecurrenceData", recurrenceXmlString);

            // If EventType is "1", this property MUST contain a valid TimeZoneXML.
            TimeZoneXML customPacificTimeZone = this.GetCustomPacificTimeZoneXmlSetting();
            recurEventFieldsSetting.Add("XMLTZone", this.GetTimeZoneXMLString(customPacificTimeZone));

            // Setting Duration field's value
            recurEventFieldsSetting.Add("Duration", "0");
            recurEventFieldsSetting.Add("Title", eventTitle);

            List<Dictionary<string, string>> addeditemsOfRecurrence = new List<Dictionary<string, string>>();
            addeditemsOfRecurrence.Add(recurEventFieldsSetting);

            List<MethodCmdEnum> cmds = new List<MethodCmdEnum>(1);
            cmds.Add(MethodCmdEnum.New);

            // add a  recurrence appointment item
            UpdateListItemsUpdates updatesOfRecurrence = this.CreateUpdateListItems(cmds, addeditemsOfRecurrence, OnErrorEnum.Continue);
            UpdateListItemsResponseUpdateListItemsResult updateResult = OutspsAdapter.UpdateListItems(listId, updatesOfRecurrence);
            this.VerifyResponseOfUpdateListItem(updateResult);

            XmlNode[] zrowitems = this.GetListItemsChangesFromSUT(listId);
            int listItemIndex = this.GetZrowItemIndexByListItemId(zrowitems, "1");
            string actualEventDateValue = Common.GetZrowAttributeValue(zrowitems, listItemIndex, "ows_EventDate");
            string actualEndDateValue = Common.GetZrowAttributeValue(zrowitems, listItemIndex, "ows_EndDate");
            string actualTimeZone = Common.GetZrowAttributeValue(zrowitems, listItemIndex, "ows_XMLTZone");
            #region Capture code
            
            // Verify MS-OUTSPS requirement: MS-OUTSPS_R879
            this.Site.CaptureRequirementIfAreEqual<string>(
                this.GetTimeZoneXMLString(customPacificTimeZone),
                actualTimeZone,
                879,
                "[In Complex Types][The complex type]TimeZoneRule Contains daylight saving time (DST) biases and TransitionDate elements (section 2.2.4.8).");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R880
            // TimeZoneXML is included in request, this requirement can be captured directly if the operation executes successfully.
            this.Site.CaptureRequirement(
                880,
                "[In Complex Types][The complex type]TimeZoneXML Contains a TimeZoneRule (section 2.2.4.6).");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R950
            // TimeZoneXML is included in request, this requirement can be captured directly if the operation executes successfully.
            this.Site.CaptureRequirement(
                950,
                @"[In TimeZoneXML complex type]The TimeZoneXML complex type contains a TimeZoneRule (section 2.2.4.6) to define a time zone.
                <s:complexType name=""TimeZoneXML"">
                  <s:sequence>
                    <s:element name=""timeZoneRule"" type=""tns:TimeZoneRule"" />
                  </s:sequence>
                </s:complexType>");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R952
            // TimeZoneXML is included in request, this requirement can be captured directly if the operation executes successfully.
            this.Site.CaptureRequirement(
                952,
                @"[In TransitionDate complex type] The TransitionDate complex type contains transition dates for DST.
                <s:complexType name=""TransitionDate"">
                  <s:sequence>
                    <s:element name=""transitionRule"">
                      <s:complexType>
                        <s:simpleContent>
                          <s:extension base=""s:string"">
                            <s:attribute name=""day"" type=""tns:DayOfWeek"" default=""su"" use=""optional"" />
                            <s:attribute name=""month"" type=""s:integer"" use=""required"" />
                            <s:attribute name=""dayOfMonth"" type=""s:integer"" use=""optional"" />
                            <s:attribute name=""weekdayOfMonth"" type=""tns:WeekdayOfMonth"" default=""first"" use=""optional"" />
                          </s:extension>
                        </s:simpleContent>
                      </s:complexType>
                    </s:element>
                    <s:element name=""transitionTime"" type=""s:string"" />
                  </s:sequence>
                </s:complexType>");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R881
            this.Site.CaptureRequirementIfAreEqual<string>(
                this.GetTimeZoneXMLString(customPacificTimeZone),
                actualTimeZone,
                881,
                "[In Complex Types][The complex type]TransitionDate Contains DST transition dates.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R945
            // TimeZoneRule is included in request, this requirement can be captured directly if the operation executes successfully.
            this.Site.CaptureRequirement(
                945,
                @"[In TimeZoneRule complex type] The TimeZoneRule complex type contains DST biases and TransitionDate (section 2.2.4.8) elements.
                <s:complexType name=""TimeZoneRule"">
                  <s:sequence>
                    <s:element name=""standardBias"" type=""s:integer"" />
                    <s:element name=""additionalDaylightBias"" type=""s:integer"" minOccurs=""0"" />
                    <s:element name=""standardDate"" type=""s1:TransitionDate"" minOccurs=""0"" />
                    <s:element name=""daylightDate"" type=""s1:TransitionDate"" minOccurs=""0"" />
                  </s:sequence>
                </s:complexType>");

            // If the EndDate and EventDate fields' values equal to the values the client set in upon steps, then capture R1264
            DateTime actualEndDate;
            if (!DateTime.TryParse(actualEndDateValue, out actualEndDate))
            {
                this.Site.Assert.Fail("The EndDate field value should be a valid DateTime format.");
            }

            DateTime actualEventDate;
            if (!DateTime.TryParse(actualEventDateValue, out actualEventDate))
            {
                this.Site.Assert.Fail("The EventDate field value should be a valid DateTime format.");
            }

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R267
            this.Site.CaptureRequirementIfIsTrue(
                DateTime.Parse(actualEndDateValue) >= DateTime.Parse(actualEventDateValue),
                267,
                "[In Appointment-Specific Schema]EndDate MUST be equal to or later than EventDate.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R271
            this.Site.CaptureRequirementIfIsTrue(
                DateTime.Parse(actualEndDateValue) >= DateTime.Parse(actualEventDateValue),
                271,
                "[In Appointment-Specific Schema]EventDate MUST be equal to or earlier than EndDate.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R272
            this.Site.CaptureRequirementIfIsFalse(
                string.IsNullOrEmpty(actualEventDateValue),
                272,
                "[In Appointment-Specific Schema]EventDate MUST NOT be empty or missing.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R275
            this.Site.CaptureRequirementIfIsFalse(
                string.IsNullOrEmpty(Common.GetZrowAttributeValue(zrowitems, listItemIndex, "ows_EventType")),
                275,
                "[In Appointment-Specific Schema]EventType MUST NOT be empty or missing.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R288
            this.Site.CaptureRequirementIfIsFalse(
                string.IsNullOrEmpty(Common.GetZrowAttributeValue(zrowitems, listItemIndex, "ows_fRecurrence")),
                288,
                "[In Appointment-Specific Schema]fRecurrence MUST NOT be empty or missing.");

            #endregion
        }
        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");
        }
        public void MSOUTSPS_S02_TC28_OperationListItems_WeekdayOfMonth()
        {
            string listId = this.AddListToSUT(TemplateType.Events);

            #region  Add 5 recurrence item

            // Setting recurring setting
            DateTime eventDateOfRecurrence = DateTime.Today.Date.AddDays(1);

            // 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 year later, and the repeat frequency is month.
            DateTime winEndDate = eventDateOfRecurrence.Date.AddYears(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.
            RepeatPatternMonthlyByDay repeatPatternMonthlyByDay = new RepeatPatternMonthlyByDay();
            repeatPatternMonthlyByDay.monthFrequency = 1;
            repeatPatternMonthlyByDay.monthFrequencySpecified = true;
            repeatPatternMonthlyByDay.fr = TrueFalseDOW.TRUE;
            repeatPatternMonthlyByDay.moSpecified = true;
            recurrenceXMLData.recurrence.rule.repeat.Item = repeatPatternMonthlyByDay;

            // Add 5 recurrence items with 5 values of WeekdayOfMonth enum.
            string[] namesOfWeekdayOfMonthEnum = Enum.GetNames(typeof(WeekdayOfMonth));
            Dictionary<string, string> listItemRecurrenceDataSettings = new Dictionary<string, string>();
            foreach (string enumNameItem in namesOfWeekdayOfMonthEnum)
            {
                List<Dictionary<string, string>> addedItemsOfRecurrence = new List<Dictionary<string, string>>();
                List<MethodCmdEnum> cmds = new List<MethodCmdEnum>(1);

                string eventTitle = this.GetUniqueListItemTitle("MonthlyByDay");
                Dictionary<string, string> settingsOfDailyRecurring = this.GetDailyRecurrenceSettingWithwindowEnd(this.GetUniqueListItemTitle("DailyRecurrenceEvent"), eventDateOfRecurrence, "1", 10);
                this.Site.Assert.IsTrue(
                               settingsOfDailyRecurring.ContainsKey("RecurrenceData"),
                               "The fields setting should contain RecurrenceData field's setting.");

                this.Site.Assert.IsTrue(
                                     settingsOfDailyRecurring.ContainsKey("Title"),
                                     "The fields setting should contain Title field's setting.");

                settingsOfDailyRecurring["Title"] = eventTitle;

                RepeatPatternMonthlyByDay currentRepeatPattern = recurrenceXMLData.recurrence.rule.repeat.Item as RepeatPatternMonthlyByDay;
                this.Site.Assert.IsNotNull(currentRepeatPattern, "The RepeatPattern should be RepeatPatternMonthlyByDay type.");

                // Update the RecurrenData field
                WeekdayOfMonth currentWeekdayOfMonthValue = (WeekdayOfMonth)Enum.Parse(typeof(WeekdayOfMonth), enumNameItem, true);
                currentRepeatPattern.weekdayOfMonthSpecified = true;
                currentRepeatPattern.weekdayOfMonth = currentWeekdayOfMonthValue;
                string recurrenceXMLString = this.GetRecurrenceXMLString(recurrenceXMLData);
                settingsOfDailyRecurring["RecurrenceData"] = recurrenceXMLString;

                // Add current list item
                addedItemsOfRecurrence.Add(settingsOfDailyRecurring);
                cmds.Add(MethodCmdEnum.New);

                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);
                listItemRecurrenceDataSettings.Add(addedRecurrenceItemIds[0], recurrenceXMLString);
            }

            this.Site.Assert.AreEqual<int>(
                                    namesOfWeekdayOfMonthEnum.Length,
                                    listItemRecurrenceDataSettings.Count,
                                    "There should be match number of list items' Recurrence data setting");

            #endregion  Add 5 recurrence item

            XmlNode[] zrowItems = this.GetListItemsChangesFromSUT(listId);
            this.Site.Assert.AreEqual<int>(
                                    namesOfWeekdayOfMonthEnum.Length,
                                    zrowItems.Count(),
                                    "The current list should contain [{0}] list items.",
                                    namesOfWeekdayOfMonthEnum.Length);

            // Verify each WeekdayOfMonth value can be set in protocol SUT successfully.
            foreach (KeyValuePair<string, string> listItemRecurrenceDataItem in listItemRecurrenceDataSettings)
            {
                string currentListItemId = listItemRecurrenceDataItem.Key;
                int zrowIndexOfCurrentListItemId = this.GetZrowItemIndexByListItemId(zrowItems, currentListItemId);
                string actualRecurrenceData = Common.GetZrowAttributeValue(zrowItems, zrowIndexOfCurrentListItemId, "ows_RecurrenceData");
                this.Site.Assert.IsFalse(
                                string.IsNullOrEmpty(actualRecurrenceData),
                                "The actual RecurrenceData field should have value.");

                string expectedRecurrenceData = listItemRecurrenceDataItem.Value.ToLower();
                this.Site.Assert.AreEqual<string>(
                                    expectedRecurrenceData.ToLower(),
                                    actualRecurrenceData.ToLower(),
                                    "The RecurrenceData field value should match the value set in the request of UpdateListItems operation.");
            }

            // If passes upon verification, then capture R1045, R1047, R1048, R1049, R1050, R1051
            // Verify MS-OUTSPS requirement: MS-OUTSPS_R1045
            this.Site.CaptureRequirement(
                                1045,
                                @"[In WeekdayOfMonth] When combined with a DayOfWeek or DayOfWeekOrMonth value, the WeekdayOfMonth simple type specifies a day of a week or month.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R1047
            this.Site.CaptureRequirement(
                                1047,
                                @"[In WeekdayOfMonth][The enumeration value]first[of the type WeekdayOfMonth means]First");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R1048
            this.Site.CaptureRequirement(
                                1048,
                                @"[In WeekdayOfMonth][The enumeration value]second[of the type WeekdayOfMonth means]Second");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R1049
            this.Site.CaptureRequirement(
                                1049,
                                @"[In WeekdayOfMonth][The enumeration value]third[of the type WeekdayOfMonth means]Third");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R1050
            this.Site.CaptureRequirement(
                                1050,
                                @"[In WeekdayOfMonth][The enumeration value]fourth[of the type WeekdayOfMonth means]Fourth");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R1051
            this.Site.CaptureRequirement(
                                1051,
                                @"[In WeekdayOfMonth][The enumeration value]last[of the type WeekdayOfMonth means]Last");
        }
        public void MSOUTSPS_S02_TC22_RecurrenceAppointmentItem_RepeatPattern()
        {
            string listId = this.AddListToSUT(TemplateType.Events);

            // Setting recurring setting
            DateTime eventDateOfRecurrence = DateTime.Today.Date.AddDays(1);
            Dictionary<string, string> settingsOfDailyRecurring = this.GetDailyRecurrenceSettingWithwindowEnd(this.GetUniqueListItemTitle("DailyRecurrenceEvent"), eventDateOfRecurrence, "1", 10);
            this.Site.Assert.IsTrue(
                            settingsOfDailyRecurring.ContainsKey("RecurrenceData"),
                            "The fields setting collection should contain RecurrenceData field setting.");

            // Setting a daily recurrence setting for RecurrenceData field.
            RecurrenceXML recurrenceXMLData = new RecurrenceXML();
            recurrenceXMLData.deleteExceptions = null;
            recurrenceXMLData.recurrence = new RecurrenceDefinition();
            recurrenceXMLData.recurrence.rule = new RecurrenceRule();
            recurrenceXMLData.recurrence.rule.firstDayOfWeek = DayOfWeekOrMonth.su;

            // Set the windowEnd value, the recurrence will be end on one week from current date.
            DateTime winEndDate = eventDateOfRecurrence.Date.AddDays(7);
            recurrenceXMLData.recurrence.rule.Item = winEndDate;

            // Repeat Pattern
            recurrenceXMLData.recurrence.rule.repeat = new RepeatPattern();

            // Setting the RepeatPatternDaily
            RepeatPatternDaily repeatPatternDailyData = new RepeatPatternDaily();
            repeatPatternDailyData.dayFrequency = "1";
            recurrenceXMLData.recurrence.rule.repeat.Item = repeatPatternDailyData;
            string recurrenceXMLString = this.GetRecurrenceXMLString(recurrenceXMLData);

            // Setting the RecurrenceData field with RepeatPattern.daily
            settingsOfDailyRecurring["RecurrenceData"] = recurrenceXMLString;

            #region add a recurrence item

            List<Dictionary<string, string>> addedItemsOfRecurrence = new List<Dictionary<string, string>>();
            List<MethodCmdEnum> cmds = new List<MethodCmdEnum>(1);

            // Add current list item
            addedItemsOfRecurrence.Add(settingsOfDailyRecurring);
            cmds.Add(MethodCmdEnum.New);

            UpdateListItemsUpdates updatesOfRecurrence = this.CreateUpdateListItems(cmds, addedItemsOfRecurrence, OnErrorEnum.Continue);
            UpdateListItemsResponseUpdateListItemsResult updateResult = OutspsAdapter.UpdateListItems(listId, updatesOfRecurrence);

            // Get the listItem id.
            this.VerifyResponseOfUpdateListItem(updateResult);
            List<string> addedRecurrenceItemIds = this.GetListItemIdsFromUpdateListItemsResponse(updateResult, 1);

            #endregion add a recurrence item

            XmlNode[] zrowItems = this.GetListItemsChangesFromSUT(listId);
            int zrowIndex = this.GetZrowItemIndexByListItemId(zrowItems, addedRecurrenceItemIds[0]);
            string actualRecurrenceXMLStringValue = Common.GetZrowAttributeValue(zrowItems, zrowIndex, "ows_RecurrenceData");

            // If the RecurrenceData field value equal to set in the request of UpdateListItems, that means setting of RepeatPattern.daily is set in the protocol SUT. If this verification passes then capture R903
            this.Site.Assert.AreEqual<string>(
                                    recurrenceXMLString.ToLower(),
                                    actualRecurrenceXMLStringValue.ToLower(),
                                    "The RecurrenceData value equal to set in the request of UpdateListItems");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R903
            this.Site.CaptureRequirement(
                           903,
                           @"[In RepeatPattern complex type]daily: If the recurrence is a daily recurrence, the daily element will be present.");
        }
        public void MSOUTSPS_S02_TC26_OperationListItems_DayOfWeekOrMonthSimpleType()
        {
            string listId = this.AddListToSUT(TemplateType.Events);

            #region  Add 5 recurrence item

            // Setting recurring setting
            DateTime eventDateOfRecurrence = DateTime.Today.Date.AddDays(1);

            // Setting common recurrenceXMLData setting
            RecurrenceXML recurrenceXMLData = new RecurrenceXML();
            recurrenceXMLData.deleteExceptions = null;
            recurrenceXMLData.recurrence = new RecurrenceDefinition();

            // Set the windowEnd value, the recurrence will be end on one week later, and the repeat frequency is daily.
            DateTime winEndDate = eventDateOfRecurrence.Date.AddDays(7);
            recurrenceXMLData.recurrence.rule = new RecurrenceRule();
            recurrenceXMLData.recurrence.rule.Item = winEndDate;

            // Repeat Pattern, set it as weekly repeat.
            recurrenceXMLData.recurrence.rule.repeat = new RepeatPattern();

            // Setting the monthFrequency. every month repeat.
            RepeatPatternDaily repeatPatternDaily = new RepeatPatternDaily();
            repeatPatternDaily.dayFrequency = "1";
            recurrenceXMLData.recurrence.rule.repeat.Item = repeatPatternDaily;

            // Add recurrence items with 10 values of WeekdayOfMonth enum.
            string[] namesOfDayOfWeekOrMonth = Enum.GetNames(typeof(DayOfWeekOrMonth));
            Dictionary<string, string> listItemRecurrenceDataSettings = new Dictionary<string, string>();
            foreach (string enumNameItem in namesOfDayOfWeekOrMonth)
            {
                List<Dictionary<string, string>> addedItemsOfRecurrence = new List<Dictionary<string, string>>();
                List<MethodCmdEnum> cmds = new List<MethodCmdEnum>(1);

                string eventTitle = this.GetUniqueListItemTitle("DayOfWeekOrMonth");
                Dictionary<string, string> settingsOfDailyRecurring = this.GetDailyRecurrenceSettingWithwindowEnd(this.GetUniqueListItemTitle("DailyRecurrenceEvent"), eventDateOfRecurrence, "1", 10);
                this.Site.Assert.IsTrue(
                               settingsOfDailyRecurring.ContainsKey("RecurrenceData"),
                               "The fields setting should contain RecurrenceData field's setting.");

                this.Site.Assert.IsTrue(
                                     settingsOfDailyRecurring.ContainsKey("Title"),
                                     "The fields setting should contain Title field's setting.");

                settingsOfDailyRecurring["Title"] = eventTitle;

                // Update the RecurrenData field with recurrence.rule.firstDayOfWeek setting
                DayOfWeekOrMonth currentDayOfWeekOrMonthValue = (DayOfWeekOrMonth)Enum.Parse(typeof(DayOfWeekOrMonth), enumNameItem, true);
                recurrenceXMLData.recurrence.rule.firstDayOfWeek = currentDayOfWeekOrMonthValue;

                string recurrenceXMLString = this.GetRecurrenceXMLString(recurrenceXMLData);
                settingsOfDailyRecurring["RecurrenceData"] = recurrenceXMLString;

                // Add current list item
                addedItemsOfRecurrence.Add(settingsOfDailyRecurring);
                cmds.Add(MethodCmdEnum.New);

                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);
                listItemRecurrenceDataSettings.Add(addedRecurrenceItemIds[0], recurrenceXMLString);
            }

            this.Site.Assert.AreEqual<int>(
                                    namesOfDayOfWeekOrMonth.Length,
                                    listItemRecurrenceDataSettings.Count,
                                    "There should be match number of list items' Recurrence data setting");

            #endregion  Add 10 recurrence item

            XmlNode[] zrowItems = this.GetListItemsChangesFromSUT(listId);
            this.Site.Assert.AreEqual<int>(
                                    namesOfDayOfWeekOrMonth.Length,
                                    zrowItems.Count(),
                                    "The current list should contain [{0}] list items.",
                                    namesOfDayOfWeekOrMonth.Length);

            // Verify each WeekdayOfMonth value can be set in protocol SUT successfully.
            foreach (KeyValuePair<string, string> listItemRecurrenceDataItem in listItemRecurrenceDataSettings)
            {
                string currentListItemId = listItemRecurrenceDataItem.Key;
                int zrowIndexOfCurrentListItemId = this.GetZrowItemIndexByListItemId(zrowItems, currentListItemId);
                string actualRecurrenceData = Common.GetZrowAttributeValue(zrowItems, zrowIndexOfCurrentListItemId, "ows_RecurrenceData");
                this.Site.Assert.IsFalse(
                                string.IsNullOrEmpty(actualRecurrenceData),
                                "The actual RecurrenceData field should have value.");

                string expectedRecurrenceData = listItemRecurrenceDataItem.Value.ToLower();
                this.Site.Assert.AreEqual<string>(
                                    expectedRecurrenceData.ToLower(),
                                    actualRecurrenceData.ToLower(),
                                    "The RecurrenceData field value should match the value set in the request of UpdateListItems operation.");
            }

            // If upon verification pass, then capture R1001, R10031, R10032, R10033, R10034, R10035, R10036, R10037, R1004, R1005, R1006
            // Verify MS-OUTSPS requirement: MS-OUTSPS_R1001
            this.Site.CaptureRequirement(
                            1001,
                            @"[In DayOfWeekOrMonth] The DayOfWeekOrMonth simple type specifies a day of the week or a day of the month.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R1004
            this.Site.CaptureRequirement(
                            1004,
                            @"[In DayOfWeekOrMonth][The enumeration value]day[of the type DayOfWeekOrMonth means]Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday are allowed.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R1005
            this.Site.CaptureRequirement(
                            1005,
                            @"[In DayOfWeekOrMonth][The enumeration value]weekday[of the type DayOfWeekOrMonth means]Monday, Tuesday, Wednesday, Thursday, and Friday are allowed.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R1006
            this.Site.CaptureRequirement(
                            1006,
                            @"[In DayOfWeekOrMonth][The enumeration value]weekend_day[of the type DayOfWeekOrMonth means]Sunday and Saturday are allowed.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R10031
            this.Site.CaptureRequirement(
                            10031,
                            @"[In DayOfWeekOrMonth][The enumeration value]su[of the type DayOfWeekOrMonth means]Sunday");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R10032
            this.Site.CaptureRequirement(
                            10032,
                            @"[In DayOfWeekOrMonth][The enumeration value]mo[of the type DayOfWeekOrMonth means]Monday");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R10033
            this.Site.CaptureRequirement(
                            10033,
                            @"[In DayOfWeekOrMonth][The enumeration value]tu[of the type DayOfWeekOrMonth means]Tuesday");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R10034
            this.Site.CaptureRequirement(
                            10034,
                            @"[In DayOfWeekOrMonth][The enumeration value]we[of the type DayOfWeekOrMonth means]Wednesday");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R10035
            this.Site.CaptureRequirement(
                            10035,
                            @"[In DayOfWeekOrMonth][The enumeration value]th[of the type DayOfWeekOrMonth means]Thursday");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R10036
            this.Site.CaptureRequirement(
                            10036,
                            @"[In DayOfWeekOrMonth][The enumeration value]fr[of the type DayOfWeekOrMonth means]Friday");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R10037
            this.Site.CaptureRequirement(
                            10037,
                            @"[In DayOfWeekOrMonth][The enumeration value]sa[of the type DayOfWeekOrMonth means]Saturday");
        }
        public void MSOUTSPS_S02_TC20_RecurrenceAppointmentItem_RecurrenceRulerepeatInstances()
        {
            string listId = this.AddListToSUT(TemplateType.Events);

            DateTime eventDate = DateTime.Today.Date.AddDays(1);

            Dictionary<string, string> recurEventFieldsSetting = this.GetDailyRecurrenceSettingWithwindowEnd(this.GetUniqueListItemTitle("YearlyRecurrenceItem"), eventDate, "1", 10);
            this.Site.Assert.IsTrue(
                            recurEventFieldsSetting.ContainsKey("RecurrenceData"),
                            "The fields setting collection should contain RecurrenceData field setting.");

            // Recurring data
            RecurrenceXML recurrenceXMLData = new RecurrenceXML();
            recurrenceXMLData.deleteExceptions = null;
            recurrenceXMLData.recurrence = new RecurrenceDefinition();
            recurrenceXMLData.recurrence.rule = new RecurrenceRule();
            recurrenceXMLData.recurrence.rule.firstDayOfWeek = DayOfWeekOrMonth.su;

            // Repeat Pattern
            recurrenceXMLData.recurrence.rule.repeat = new RepeatPattern();
            RepeatPatternYearlyByDay repeatPatternYearlyByDay = new RepeatPatternYearlyByDay();

            // Setting the repeatPatternYearlyByDay value
            repeatPatternYearlyByDay.mo = TrueFalseDOW.TRUE;
            repeatPatternYearlyByDay.moSpecified = true;

            // Each year occurs one time.
            repeatPatternYearlyByDay.yearFrequency = "1";

            // Occurs on second week
            repeatPatternYearlyByDay.weekdayOfMonth = WeekdayOfMonth.second;
            repeatPatternYearlyByDay.weekdayOfMonthSpecified = true;

            // Occurs on current month
            repeatPatternYearlyByDay.month = eventDate.Month.ToString();
            recurrenceXMLData.recurrence.rule.repeat.Item = repeatPatternYearlyByDay;

            // Setting the repeatInstances to repeat ten times.
            recurrenceXMLData.recurrence.rule.Item = "10";

            string recurrenceXmlString = this.GetRecurrenceXMLString(recurrenceXMLData);

            // If the EventType indicates a recurring event, then fRecurrence MUST be "1". 
            recurEventFieldsSetting["EventType"] = "1";

            // "0" means this is not an all-day event.
            recurEventFieldsSetting["fAllDayEvent"] = "0";

            // "1" means this is a recurrence event.
            recurEventFieldsSetting["fRecurrence"] = "1";

            // If EventType is "1", this property MUST contain a valid RecurrenceXML.
            recurEventFieldsSetting["RecurrenceData"] = recurrenceXmlString;
            DateTime endTime = eventDate.AddHours(1);

            // For yearly recurrence item, the end date must larger than the current year + repeatInstances.
            recurEventFieldsSetting["EndDate"] = this.GetGeneralFormatTimeString(endTime.AddYears(100));
            List<Dictionary<string, string>> addeditemsOfRecurrence = new List<Dictionary<string, string>>();
            addeditemsOfRecurrence.Add(recurEventFieldsSetting);

            List<MethodCmdEnum> cmds = new List<MethodCmdEnum>(1);
            cmds.Add(MethodCmdEnum.New);

            // add a recurrence appointment item
            UpdateListItemsUpdates updatesOfRecurrence = this.CreateUpdateListItems(cmds, addeditemsOfRecurrence, OnErrorEnum.Continue);
            UpdateListItemsResponseUpdateListItemsResult updateResult = OutspsAdapter.UpdateListItems(listId, updatesOfRecurrence);
            this.VerifyResponseOfUpdateListItem(updateResult);
            XmlNode[] zrowitems = this.GetListItemsChangesFromSUT(listId);
            int listItemIndex = this.GetZrowItemIndexByListItemId(zrowitems, "1");

            #region Capture code

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R1266
            this.Site.CaptureRequirementIfAreEqual(
                recurrenceXmlString,
                Common.GetZrowAttributeValue(zrowitems, listItemIndex, "ows_RecurrenceData"),
                1266,
                "[In RecurrenceRule complex type] repeatInstances: Client set this value[repeatInstances], and later client retrieve the value[repeatInstances] from the server, they should be equal.specified by this element.");

            #endregion
        }
        public void MSOUTSPS_S02_TC21_RecurrenceAppointmentItem_RecurrenceDefinition()
        {
            string listId = this.AddListToSUT(TemplateType.Events);

            // Setting recurring setting
            DateTime eventDateOfRecurrence = DateTime.Today.Date.AddDays(1);
            Dictionary<string, string> settingsOfDailyRecurring = this.GetDailyRecurrenceSettingWithwindowEnd(this.GetUniqueListItemTitle("YearlyRecurrenceItem"), eventDateOfRecurrence, "1", 10);
            this.Site.Assert.IsTrue(
                            settingsOfDailyRecurring.ContainsKey("RecurrenceData"),
                            "The fields setting collection should contain RecurrenceData field setting.");

            // Setting a yearly recurrence setting for RecurrenceData field.
            RecurrenceXML recurrenceXMLData = new RecurrenceXML();
            recurrenceXMLData.deleteExceptions = null;
            recurrenceXMLData.recurrence = new RecurrenceDefinition();
            recurrenceXMLData.recurrence.rule = new RecurrenceRule();
            recurrenceXMLData.recurrence.rule.firstDayOfWeek = DayOfWeekOrMonth.su;

            // Set the repeatInstances value, it will end after 3 occurrences.
            int repeatInstanceValue = 3;
            recurrenceXMLData.recurrence.rule.Item = repeatInstanceValue.ToString();

            // Repeat Pattern
            recurrenceXMLData.recurrence.rule.repeat = new RepeatPattern();

            // Setting the RepeatPatternYearly, make the recurrence occur on 04-01 for every year.
            RepeatPatternYearly repeatPatternYearlyData = new RepeatPatternYearly();
            repeatPatternYearlyData.day = "1";
            repeatPatternYearlyData.month = "4";
            repeatPatternYearlyData.yearFrequency = "1";
            recurrenceXMLData.recurrence.rule.repeat.Item = repeatPatternYearlyData;
            string recurrenceXMLString = this.GetRecurrenceXMLString(recurrenceXMLData);

            // Setting the RecurrenceData field with RepeatPattern
            settingsOfDailyRecurring["RecurrenceData"] = recurrenceXMLString;

            // Setting the EndDate field to match the Yearly and repeatInstances setting.
            this.Site.Assert.IsTrue(
                            settingsOfDailyRecurring.ContainsKey("EndDate"),
                            "The fields setting collection should contain EndDate field setting.");

            // The recurrence item end time.
            DateTime endTime = eventDateOfRecurrence.AddHours(1);

            // For yearly recurrence item, the end date must larger than the current year + repeatInstances.
            settingsOfDailyRecurring["EndDate"] = this.GetGeneralFormatTimeString(endTime.AddYears(100));

            #region add a recurrence item

            List<Dictionary<string, string>> addedItemsOfRecurrence = new List<Dictionary<string, string>>();
            List<MethodCmdEnum> cmds = new List<MethodCmdEnum>(1);

            // Add current list item
            addedItemsOfRecurrence.Add(settingsOfDailyRecurring);
            cmds.Add(MethodCmdEnum.New);

            UpdateListItemsUpdates updatesOfRecurrence = this.CreateUpdateListItems(cmds, addedItemsOfRecurrence, OnErrorEnum.Continue);
            UpdateListItemsResponseUpdateListItemsResult updateResult = OutspsAdapter.UpdateListItems(listId, updatesOfRecurrence);

            // Get the listItem id.
            this.VerifyResponseOfUpdateListItem(updateResult);
            List<string> addedRecurrenceItemIds = this.GetListItemIdsFromUpdateListItemsResponse(updateResult, 1);

            #endregion add a recurrence item

            XmlNode[] zrowItems = this.GetListItemsChangesFromSUT(listId);
            int zrowIndex = this.GetZrowItemIndexByListItemId(zrowItems, addedRecurrenceItemIds[0]);
            string actualRecurrenceXMLStringValue = Common.GetZrowAttributeValue(zrowItems, zrowIndex, "ows_RecurrenceData");

            // If the RecurrenceData field value equal to set in the request of UpdateListItems, that means setting of RecurrenceDefinition.rule is set in the protocol SUT. If this verification passes then capture R897
            this.Site.Assert.AreEqual<string>(
                                    recurrenceXMLString.ToLower(),
                                    actualRecurrenceXMLStringValue.ToLower(),
                                    "The RecurrenceData value equal to set in the request of UpdateListItems");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R897
            this.Site.CaptureRequirement(
                           897,
                           @"[In RecurrenceDefinition complex type]rule: Contains a recurrence rule that defines a recurrence.");
        }
        public void MSOUTSPS_S02_TC19_RecurrenceAppointmentItem_RecurrenceRulerepeatForever()
        {
            string listId = this.AddListToSUT(TemplateType.Events);

            Dictionary<string, string> recurEventFieldsSetting = new Dictionary<string, string>();
            DateTime eventDate = DateTime.Today.Date.AddDays(1);
            DateTime endDate = eventDate.Date.AddHours(1);
            string eventDateValue = this.GetGeneralFormatTimeString(eventDate);
            string endDateValue = this.GetGeneralFormatTimeString(endDate);

            // Recurring data
            RecurrenceXML recurrenceXMLData = new RecurrenceXML();
            recurrenceXMLData.deleteExceptions = null;
            recurrenceXMLData.recurrence = new RecurrenceDefinition();
            recurrenceXMLData.recurrence.rule = new RecurrenceRule();
            recurrenceXMLData.recurrence.rule.firstDayOfWeek = DayOfWeekOrMonth.su;
            recurrenceXMLData.recurrence.rule.Item = "FALSE";

            // Repeat Pattern
            recurrenceXMLData.recurrence.rule.repeat = new RepeatPattern();
            RepeatPatternDaily repeatPatternDailyData = new RepeatPatternDaily();

            // Setting the dayFrequencyValue
            repeatPatternDailyData.dayFrequency = "1";
            recurrenceXMLData.recurrence.rule.repeat.Item = repeatPatternDailyData;

            string recurrenceXmlString = this.GetRecurrenceXMLString(recurrenceXMLData);

            // Setting necessary fields' value
            recurEventFieldsSetting.Add("EventDate", eventDateValue);

            // The ending date and time of the appointment.
            recurEventFieldsSetting.Add("EndDate", endDateValue);

            // If the EventType indicates a recurring event, then fRecurrence MUST be "1". 
            recurEventFieldsSetting.Add("EventType", "1");

            // "0" means this is not an all-day event.
            recurEventFieldsSetting.Add("fAllDayEvent", "0");

            // "1" means this is a recurrence event.
            recurEventFieldsSetting.Add("fRecurrence", "1");

            // If EventType is "1", this property MUST contain a valid RecurrenceXML.
            recurEventFieldsSetting.Add("RecurrenceData", recurrenceXmlString);

            List<Dictionary<string, string>> addeditemsOfRecurrence = new List<Dictionary<string, string>>();
            addeditemsOfRecurrence.Add(recurEventFieldsSetting);

            List<MethodCmdEnum> cmds = new List<MethodCmdEnum>(1);
            cmds.Add(MethodCmdEnum.New);

            // add a  recurrence appointment item
            UpdateListItemsUpdates updatesOfRecurrence = this.CreateUpdateListItems(cmds, addeditemsOfRecurrence, OnErrorEnum.Continue);
            UpdateListItemsResponseUpdateListItemsResult updateResult = OutspsAdapter.UpdateListItems(listId, updatesOfRecurrence);
            this.VerifyResponseOfUpdateListItem(updateResult);
            XmlNode[] zrowitems = this.GetListItemsChangesFromSUT(listId);
            int listItemIndex = this.GetZrowItemIndexByListItemId(zrowitems, "1");

            #region Capture code

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R1263
            this.Site.CaptureRequirementIfAreEqual(
                recurrenceXmlString,
                Common.GetZrowAttributeValue(zrowitems, listItemIndex, "ows_RecurrenceData"),
                1263,
                "[In RecurrenceRule complex type] repeatForever: Client set this value[repeatForever], and later client retrieve the value[repeatForever] from the server, they should be equal.");

            #endregion
        }
        public void MSOUTSPS_S02_TC17_RecurrenceAppointmentItem_RecurrenceDataValid()
        {
            string listId = this.AddListToSUT(TemplateType.Events);

            Dictionary<string, string> recurEventFieldsSetting = new Dictionary<string, string>();
            DateTime eventDate = DateTime.Today.Date.AddDays(1);
            DateTime endDate = eventDate.Date.AddHours(1);
            string eventDateValue = this.GetGeneralFormatTimeString(eventDate);
            string endDateValue = this.GetGeneralFormatTimeString(endDate);
            string eventTitle = this.GetUniqueListItemTitle("RecurrenceEvent");

            recurEventFieldsSetting.Add("Title", eventTitle);

            // Recurring data
            RecurrenceXML recurrenceXMLData = new RecurrenceXML();
            recurrenceXMLData.deleteExceptions = null;
            recurrenceXMLData.recurrence = new RecurrenceDefinition();
            recurrenceXMLData.recurrence.rule = new RecurrenceRule();
            recurrenceXMLData.recurrence.rule.firstDayOfWeek = DayOfWeekOrMonth.su;

            // Repeat Pattern
            recurrenceXMLData.recurrence.rule.repeat = new RepeatPattern();
            RepeatPatternDaily repeatPatternDailyData = new RepeatPatternDaily();

            // Setting the dayFrequencyValue
            repeatPatternDailyData.dayFrequency = "1";
            recurrenceXMLData.recurrence.rule.repeat.Item = repeatPatternDailyData;
            recurrenceXMLData.recurrence.rule.Item = "7";
            string recurrenceXmlString = this.GetRecurrenceXMLString(recurrenceXMLData);

            // Setting necessary fields' value
            recurEventFieldsSetting.Add("EventDate", eventDateValue);

            // The ending date and time of the appointment.
            recurEventFieldsSetting.Add("EndDate", endDateValue);

            // If the EventType indicates a recurring event, then fRecurrence MUST be "1". 
            recurEventFieldsSetting.Add("EventType", "1");

            // "0" means this is not an all-day event.
            recurEventFieldsSetting.Add("fAllDayEvent", "0");

            // "1" means this is a recurrence event.
            recurEventFieldsSetting.Add("fRecurrence", "1");

            // If EventType is "1", this property MUST contain a valid RecurrenceXML.
            recurEventFieldsSetting.Add("RecurrenceData", recurrenceXmlString);

            List<Dictionary<string, string>> addeditemsOfRecurrence = new List<Dictionary<string, string>>();
            addeditemsOfRecurrence.Add(recurEventFieldsSetting);

            List<MethodCmdEnum> cmds = new List<MethodCmdEnum>(1);
            cmds.Add(MethodCmdEnum.New);

            // add a  recurrence appointment item
            UpdateListItemsUpdates updatesOfRecurrence = this.CreateUpdateListItems(cmds, addeditemsOfRecurrence, OnErrorEnum.Continue);
            UpdateListItemsResponseUpdateListItemsResult updateResult = OutspsAdapter.UpdateListItems(listId, updatesOfRecurrence);

            XmlNode[] zrowitems = this.GetListItemsChangesFromSUT(listId);
            int listItemIndex = this.GetZrowItemIndexByListItemId(zrowitems, "1");
            XmlNode[] zrowItemsOfRecurrenceAppointment = this.GetZrowItems(updateResult.Results[0].Any);
            string updatedRecurrenceDataValue = Common.GetZrowAttributeValue(zrowItemsOfRecurrenceAppointment, 0, "ows_RecurrenceData");

            #region Capture code

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R297
            this.Site.CaptureRequirementIfIsTrue(
                Common.GetZrowAttributeValue(zrowitems, listItemIndex, "ows_EventType") == "1" && Common.GetZrowAttributeValue(zrowitems, listItemIndex, "ows_RecurrenceData") == recurrenceXmlString,
                297,
                "[In Appointment-Specific Schema]RecurrenceData: If EventType is 1, this property MUST contain a valid RecurrenceXML (section 2.2.4.4).");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R898
            this.Site.CaptureRequirementIfIsTrue(
                this.VerifyComplexTypesSchema(updatedRecurrenceDataValue, typeof(RecurrenceXML)),
                898,
                @"[In Complex Types]The RecurrenceXML complex type contains a RecurrenceDefinition (section 2.2.4.3).
                    <s:complexType name=""RecurrenceXML"">
                      <s:sequence>
                        <s:element name=""recurrence"" type=""tns:RecurrenceDefinition"" />
                        <s:element name=""deleteExceptions"" type=""s:string"" fixed=""true"" minOccurs=""0"" maxOccurs=""1"" />
                      </s:sequence>
                    </s:complexType>");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R877
            this.Site.CaptureRequirementIfIsTrue(
                this.VerifyComplexTypesSchema(updatedRecurrenceDataValue, typeof(RecurrenceXML)),
                877,
                "[In Complex Types][The complex type]RecurrenceXML Contains a RecurrenceDefinition (section 2.2.4.3).");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R896
            this.Site.CaptureRequirementIfIsTrue(
                this.VerifyComplexTypesSchema(updatedRecurrenceDataValue, typeof(RecurrenceXML)),
                896,
                @"[In RecurrenceDefinition complex type] The RecurrenceDefinition complex type contains a RecurrenceRule (section 2.2.4.2).   
                    <s:complexType name=""RecurrenceDefinition"">
                      <s:sequence>
                        <s:element name=""rule"" type=""tns:RecurrenceRule"" />
                      </s:sequence>
                    </s:complexType>");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R876
            this.Site.CaptureRequirementIfIsTrue(
                this.VerifyComplexTypesSchema(updatedRecurrenceDataValue, typeof(RecurrenceXML)),
                876,
                "[In Complex Types][The complex type]RecurrenceDefinition Contains a RecurrenceRule (section 2.2.4.2).");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R888
            this.Site.CaptureRequirementIfIsTrue(
                this.VerifyComplexTypesSchema(updatedRecurrenceDataValue, typeof(RecurrenceXML)),
                888,
                @"[In RecurrenceRule complex type] The RecurrenceRule complex type defines when a recurrence takes place.
                    <s:complexType name=""RecurrenceRule"">
                      <s:sequence>
                        <s:element name=""firstDayOfWeek"" type=""tns:DayOfWeekOrMonth"" />
                        <s:element name=""repeat"" type=""tns:RepeatPattern"" />
                        <s:choice>
                          <s:element name=""windowEnd"" type=""s:dateTime"" />
                          <s:element name=""repeatForever"">
                            <s:simpleType>
                              <s:restriction base=""s:string"">            
                                <s:enumeration value=""FALSE"" />
                              </s:restriction>
                            </s:simpleType>
                          </s:element>
                          <s:element name=""repeatInstances"" type=""s:integer"" />
                        </s:choice>
                      </s:sequence>
                    </s:complexType>");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R875
            this.Site.CaptureRequirementIfIsTrue(
                this.VerifyComplexTypesSchema(updatedRecurrenceDataValue, typeof(RecurrenceXML)),
                875,
                "[In Complex Types][The complex type]RecurrenceRule Defines when a recurrence takes place.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R878
            this.Site.CaptureRequirementIfIsTrue(
                this.VerifyComplexTypesSchema(updatedRecurrenceDataValue, typeof(RecurrenceXML)),
                878,
                "[In Complex Types][The complex type]RepeatPattern Contains a choice of elements which describe what days a recurrence occurs on.");

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R902
            this.Site.CaptureRequirementIfIsTrue(
                this.VerifyComplexTypesSchema(updatedRecurrenceDataValue, typeof(RecurrenceXML)),
                902,
                @"[In Complex Types]The RepeatPattern complex type contains a choice of elements which describe what days a recurrence occurs on.
                    <s:complexType name=""RepeatPattern"">
                        < s:choice >
                            < s:element name = ""daily"" >
                            < s:complexType >
                                < s:simpleContent >
                                < s:extension base = ""s:string"" >
                                    < s:attribute name = ""weekday"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""dayFrequency"" type = ""s:integer"" default= ""1"" use = ""optional"" />
                                </ s:extension >
                                </ s:simpleContent >
                            </ s:complexType >
                            </ s:element >
                            < s:element name = ""weekly"" >
                            < s:complexType >
                                < s:simpleContent >
                                < s:extension base = ""s:string"" >
                                    < s:attribute name = ""su"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""mo"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""tu"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""we"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""th"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""fr"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""sa"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""weekFrequency"" type = ""s:integer"" default= ""1"" use = ""optional"" />
                                </ s:extension >
                                </ s:simpleContent >
                            </ s:complexType >
                            </ s:element >
                            < s:element name = ""monthlyByDay"" >
                            < s:complexType >
                                < s:simpleContent >
                                < s:extension base = ""s:string"" >
                                    < s:attribute name = ""su"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""mo"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""tu"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""we"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""th"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""fr"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""sa"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""day"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""weekday"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""weekend_day"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""monthFrequency"" type = ""s:integer"" default= ""1"" use = ""optional"" />
                                    < s:attribute name = ""weekdayOfMonth"" type = ""tns:WeekdayOfMonth"" default= ""first"" use = ""optional"" />
                                </ s:extension >
                                </ s:simpleContent >
                            </ s:complexType >
                            </ s:element >
                            < s:element name = ""monthly"" >
                            < s:complexType >
                                < s:simpleContent >
                                < s:extension base = ""s:string"" >
                                    < s:attribute name = ""monthFrequency"" type = ""s:integer"" default= ""1"" use = ""optional"" />
                                    < s:attribute name = ""day"" type = ""s:integer"" default= ""1"" use = ""optional"" />
                                </ s:extension >
                                </ s:simpleContent >
                            </ s:complexType >
                            </ s:element >
                            < s:element name = ""yearly"" >
                            < s:complexType >
                                < s:simpleContent >
                                < s:extension base = ""s:string"" >
                                    < s:attribute name = ""yearFrequency"" type = ""s:integer"" default= ""1"" use = ""optional"" />
                                    < s:attribute name = ""month"" type = ""s:integer"" default= ""1"" use = ""optional"" />
                                    < s:attribute name = ""day"" type = ""s:integer"" default= ""1"" use = ""optional"" />
                                </ s:extension >
                                </ s:simpleContent >
                            </ s:complexType >
                            </ s:element >
                            < s:element name = ""yearlyByDay"" >
                            < s:complexType >
                                < s:simpleContent >
                                < s:extension base = ""s:string"" >
                                    < s:attribute name = ""su"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""mo"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""tu"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""we"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""th"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""fr"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""sa"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""day"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""weekday"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""weekend_day"" type = ""tns:TrueFalseDOW"" default= ""FALSE"" use = ""optional"" />
                                    < s:attribute name = ""yearFrequency"" type = ""s:integer"" default= ""1"" use = ""optional"" />
                                    < s:attribute name = ""month"" type = ""s:integer"" default= ""1"" use = ""optional"" />
                                    < s:attribute name = ""weekdayOfMonth"" type = ""tns:WeekdayOfMonth"" default= ""first"" use = ""optional"" />
                                </ s:extension >
                                </ s:simpleContent >
                            </ s:complexType >
                            </ s:element >
                        </ s:choice >
                        </ s:complexType >
                    ");

            #endregion
        }
        public void MSOUTSPS_S02_TC14_RecurrenceAppointmentItem_VerifyUIDField()
        {
            string listId = this.AddListToSUT(TemplateType.Events);

            Dictionary<string, string> recurEventFieldsSetting = new Dictionary<string, string>();
            DateTime eventDate = DateTime.Today.Date.AddDays(1);
            DateTime endDate = eventDate.Date.AddHours(1);
            string eventDateValue = this.GetGeneralFormatTimeString(eventDate);
            string endDateValue = this.GetGeneralFormatTimeString(endDate);
            string eventTitle = this.GetUniqueListItemTitle("RecurrenceEvent");

            recurEventFieldsSetting.Add("Title", eventTitle);

            Guid uid = Guid.NewGuid();

            // Recurring data
            RecurrenceXML recurrenceXMLData = new RecurrenceXML();
            recurrenceXMLData.deleteExceptions = null;
            recurrenceXMLData.recurrence = new RecurrenceDefinition();
            recurrenceXMLData.recurrence.rule = new RecurrenceRule();
            recurrenceXMLData.recurrence.rule.firstDayOfWeek = DayOfWeekOrMonth.su;

            // Repeat Pattern
            recurrenceXMLData.recurrence.rule.repeat = new RepeatPattern();
            RepeatPatternDaily repeatPatternDailyData = new RepeatPatternDaily();

            // Setting the dayFrequencyValue
            repeatPatternDailyData.dayFrequency = "1";
            recurrenceXMLData.recurrence.rule.repeat.Item = repeatPatternDailyData;
            recurrenceXMLData.recurrence.rule.Item = "7";
            string recurrenceXmlString = this.GetRecurrenceXMLString(recurrenceXMLData);

            // Setting necessary fields' value
            recurEventFieldsSetting.Add("EventDate", eventDateValue);

            // The ending date and time of the appointment.
            recurEventFieldsSetting.Add("EndDate", endDateValue);

            // "1" indicates a recurring event. 
            recurEventFieldsSetting.Add("EventType", "1");

            // "0" means this is not an all-day event.
            recurEventFieldsSetting.Add("fAllDayEvent", "0");

            // "1" means this is a recurrence event.
            recurEventFieldsSetting.Add("fRecurrence", "1");

            // If EventType is "1", this property MUST contain a valid RecurrenceXML.
            recurEventFieldsSetting.Add("RecurrenceData", recurrenceXmlString);

            List<Dictionary<string, string>> addeditemsOfRecurrence = new List<Dictionary<string, string>>();
            addeditemsOfRecurrence.Add(recurEventFieldsSetting);

            List<MethodCmdEnum> cmds = new List<MethodCmdEnum>(1);
            cmds.Add(MethodCmdEnum.New);

            // add a  recurrence appointment item
            UpdateListItemsUpdates updatesOfRecurrence = this.CreateUpdateListItems(cmds, addeditemsOfRecurrence, OnErrorEnum.Continue);
            UpdateListItemsResponseUpdateListItemsResult updateResult = OutspsAdapter.UpdateListItems(listId, updatesOfRecurrence);
            List<string> recurrenceItemIds = this.GetListItemIdsFromUpdateListItemsResponse(updateResult, 1);

            #region Update the recurrence event
            Dictionary<string, string> recurEventFieldsSettingUpdate = new Dictionary<string, string>();
            recurEventFieldsSettingUpdate.Add("ID", recurrenceItemIds[0]);

            // If fRecurrence is true, this property MUST contain a valid stringGUID.
            recurEventFieldsSettingUpdate.Add("UID", uid.ToString());

            List<Dictionary<string, string>> addeditemsOfRecurrenceUpdate = new List<Dictionary<string, string>>();
            addeditemsOfRecurrenceUpdate.Add(recurEventFieldsSettingUpdate);

            List<MethodCmdEnum> cmdsUpdate = new List<MethodCmdEnum>(1);
            cmdsUpdate.Add(MethodCmdEnum.Update);

            // Update the recurrence event
            UpdateListItemsUpdates updatesOfRecurrenceUpdate = this.CreateUpdateListItems(cmdsUpdate, addeditemsOfRecurrenceUpdate, OnErrorEnum.Continue);
            UpdateListItemsResponseUpdateListItemsResult updateResultUpdate = OutspsAdapter.UpdateListItems(listId, updatesOfRecurrenceUpdate);
            this.VerifyResponseOfUpdateListItem(updateResultUpdate);
            #endregion

            XmlNode[] zrowitems = this.GetListItemsChangesFromSUT(listId);
            int listItemIndex = this.GetZrowItemIndexByListItemId(zrowitems, "1");
            string actualUIDValue = Common.GetZrowAttributeValue(zrowitems, listItemIndex, "ows_UID");

            #region Capture code

            Guid actualUID;
            if (!Guid.TryParse(actualUIDValue, out actualUID))
            {
                this.Site.Assert.Fail("The UID field should be valid GUID format.");
            }

            // Verify MS-OUTSPS requirement: MS-OUTSPS_R312
            this.Site.CaptureRequirementIfAreEqual<Guid>(
                uid,
                actualUID,
                312,
                "[In Appointment-Specific Schema]UID MUST be changed if, and only if, the recurrence has been changed or added. ");

            #endregion
        }
        /// <summary>
        /// Generate a daily recurrence setting with specified dayFrequency, specified title and duration.
        /// </summary>
        /// <param name="eventTitle">A parameter represents the title of event.</param>
        /// <param name="eventDate">A parameter represents the event date of event. The end date of the event is computed from this parameter by this formula: eventDate + 1 hour.</param>
        /// <param name="dayFrequencyValue">A parameter represents the value of daily recurrent frequency.</param>
        /// <param name="durationOfRecurrence">A parameter represents the duration of the recurrence event </param>
        /// <returns>A return value represents the daily recurrence setting with computed windowEnd value. windowEnd value is computed from durationOfRecurrence and eventDate parameters.</returns>
        protected Dictionary<string, string> GetDailyRecurrenceSettingWithwindowEnd(string eventTitle, DateTime eventDate, string dayFrequencyValue, double durationOfRecurrence)
        {
            if (string.IsNullOrEmpty(eventTitle))
            {
                throw new ArgumentException("Value should not be null or empty", "eventTitle");
            }

            // Recurring data
            RecurrenceXML recurrenceXMLData = new RecurrenceXML();
            recurrenceXMLData.deleteExceptions = null;
            recurrenceXMLData.recurrence = new RecurrenceDefinition();
            recurrenceXMLData.recurrence.rule = new RecurrenceRule();
            recurrenceXMLData.recurrence.rule.firstDayOfWeek = DayOfWeekOrMonth.su;

            // Set the windowEnd value, the recurrence will be end on durationOfRecurrence + 1 days from current date, and the recurrence duration should be equal to durationOfRecurrence.
            DateTime endDate = eventDate.AddHours(1);
            DateTime winEndDate = eventDate.Date.AddDays(durationOfRecurrence);
            recurrenceXMLData.recurrence.rule.Item = winEndDate;

            // Repeat Pattern
            recurrenceXMLData.recurrence.rule.repeat = new RepeatPattern();
            RepeatPatternDaily repeatPatternDailyData = new RepeatPatternDaily();

            // Setting the dayFrequencyValue
            repeatPatternDailyData.dayFrequency = dayFrequencyValue;
            recurrenceXMLData.recurrence.rule.repeat.Item = repeatPatternDailyData;

            string recurrenceXMLString = this.GetRecurrenceXMLString(recurrenceXMLData);

            // Generate a daily recurrence setting with specified dayFrequency, specified title and durationOfRecurrence.
            Dictionary<string, string> dailyRecurrenceSetting = this.GetGeneralRecurrenceEventFieldsSetting(eventTitle, eventDate, endDate, recurrenceXMLString);
            return dailyRecurrenceSetting;
        }
        /// <summary>
        /// A method used to get a recurrence XML string, which is used to setting the recurrence appointment item on event list. 
        /// </summary>
        /// <param name="recurrenceXMLData">A parameter represents the RecurrenceXML type instance which include the setting the settings of recurrence appointment.</param>
        /// <returns>A return value represents the serialized xml string from specified RecurrenceXML type instance.</returns>
        protected string GetRecurrenceXMLString(RecurrenceXML recurrenceXMLData)
        {
            string serializedXMLstring = string.Empty;
            StringBuilder strBuilder = new StringBuilder();
            using (StringWriter stringWriter = new StringWriter(strBuilder))
            {
                XmlSerializer xmlSerializer = new XmlSerializer(typeof(RecurrenceXML));
                xmlSerializer.Serialize(stringWriter, recurrenceXMLData);
                serializedXMLstring = strBuilder.ToString();
            }

            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(serializedXMLstring);
            var recurrenceXMLElementitems = from XmlNode childNodeItem in xmlDoc.ChildNodes
                                            where childNodeItem.LocalName.Equals("RecurrenceXML", StringComparison.OrdinalIgnoreCase)
                                            select childNodeItem;

            if (0 == recurrenceXMLElementitems.Count())
            {
                this.Site.Assert.Fail("The de-serialize XML string should contain expected RecurrenceXML element. Current XML string:\r\n[{0}]", serializedXMLstring);
            }

            XmlElement recurrenceXMLElement = (XmlElement)recurrenceXMLElementitems.ElementAt<XmlNode>(0);
            serializedXMLstring = recurrenceXMLElement.InnerXml;
            serializedXMLstring = serializedXMLstring.Replace(@" xmlns=""http://schemas.microsoft.com/sharepoint/soap/""", string.Empty);
            return serializedXMLstring;
        }