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.");
        }