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

MSASTASK_S01_TC22_CreateTaskItemRecursYearlyWithCalendarTypeReturned() private method

        public void MSASTASK_S01_TC22_CreateTaskItemRecursYearlyWithCalendarTypeReturned()
        {
            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 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 = 5,
                Start = DateTime.Now,
                OccurrencesSpecified = true,
                Occurrences = 3,
                DayOfMonthSpecified = true,
                DayOfMonth = 10,
                MonthOfYearSpecified = true,
                MonthOfYear = 2
            };
            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_R8212");

            // Verify MS-ASTASK requirement: MS-ASTASK_R8212
            // If CalendarTypeSpecified is true, CalendarType element is returned from server.
            Site.CaptureRequirementIfIsTrue(
                syncedTaskItem.Task.Recurrence.CalendarTypeSpecified,
                8212,
                @"[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 5;");

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

            // Verify MS-ASTASK requirement: MS-ASTASK_R204
            Site.CaptureRequirementIfAreEqual<byte?>(
                0,
                syncedTaskItem.Task.Recurrence.IsLeapMonth,
                204,
                @"[In IsLeapMonth] The default value of the IsLeapMonth element is 0.");
        }