Microsoft.Protocols.TestSuites.MS_ASTASK.S01_SyncCommand.MSASTASK_S01_TC23_CreateTaskItemRecursYearlyOnTheNthDayWithCalendarTypeReturned C# (CSharp) Method

MSASTASK_S01_TC23_CreateTaskItemRecursYearlyOnTheNthDayWithCalendarTypeReturned() private method

        public void MSASTASK_S01_TC23_CreateTaskItemRecursYearlyOnTheNthDayWithCalendarTypeReturned()
        {
            Site.Assume.AreNotEqual<string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The CalendarType element is not supported when the MS-ASProtocolVersion header is set to 12.1. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");

            #region Call Sync command to create task item which recurs yearly on the nth day and with CalendarType set.

            Dictionary<Request.ItemsChoiceType8, object> taskItem = new Dictionary<Request.ItemsChoiceType8, object>();
            string subject = Common.GenerateResourceName(Site, "subject");

            taskItem.Add(Request.ItemsChoiceType8.Subject2, subject);
            Request.Recurrence1 recurrence = new Request.Recurrence1
            {
                Type = 6,
                Start = DateTime.Now,
                OccurrencesSpecified = true,
                Occurrences = 4,
                DayOfWeekSpecified = true,
                DayOfWeek = 3,
                WeekOfMonthSpecified = true,
                WeekOfMonth = 2,
                MonthOfYearSpecified = true,
                MonthOfYear = 10
            };
            taskItem.Add(Request.ItemsChoiceType8.Recurrence1, recurrence);
            SyncStore syncResponse = this.SyncAddTask(taskItem);

            Site.Assert.AreEqual<int>(1, int.Parse(syncResponse.AddResponses[0].Status), "Task item should be created successfully.");

            ItemsNeedToDelete.Add(subject);

            #endregion

            #region Call Sync command to get the task item.

            SyncItem syncedTaskItem = this.GetChangeItem(this.UserInformation.TasksCollectionId, subject);
            Site.Assert.IsNotNull(syncedTaskItem.Task, "The task which subject is {0} should exist in server.", subject);

            #endregion

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASTASK_R8213");

            // Verify MS-ASTASK requirement: MS-ASTASK_R8213
            // If CalendarTypeSpecified is true, CalendarType element is returned from server.
            Site.CaptureRequirementIfIsTrue(
                syncedTaskItem.Task.Recurrence.CalendarTypeSpecified,
                8213,
                @"[In CalendarType] A command response has a minimum of one CalendarType child element per Recurrence element when the Type element is set to a value of 6;");
        }