Microsoft.Protocols.TestSuites.MS_ASCAL.S01_CalendarElement.MSASCAL_S01_TC22_Status6WithSpecifiedCalendarType C# (CSharp) Method

MSASCAL_S01_TC22_Status6WithSpecifiedCalendarType() private method

private MSASCAL_S01_TC22_Status6WithSpecifiedCalendarType ( ) : void
return void
        public void MSASCAL_S01_TC22_Status6WithSpecifiedCalendarType()
        {
            Site.Assume.AreNotEqual<string>("16.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The recurring calendar item cannot be created when protocol version is set to 16.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");

            #region Define common variables.

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

            Dictionary<Request.ItemsChoiceType8, object> calendarItem = new Dictionary<Request.ItemsChoiceType8, object>();
            byte recurrenceType = byte.Parse("2");
            int occurrences = 3;
            int interval = 3;

            #endregion

            #region Call Sync command to add a calendar with the element Recurrence including CalendarType sub-element which is set as "13" to the server, and sync calendars from the server.

            // Set Calendar Recurrence element, CalendarType is set to "13".
            Request.Recurrence recurrence = this.CreateRecurrenceIncludingCalendarType(this.CreateCalendarRecurrence(recurrenceType, occurrences, interval), byte.Parse("13"));
            calendarItem.Add(Request.ItemsChoiceType8.Recurrence, recurrence);

            SyncStore addCalendarResponse = this.AddSyncCalendar(calendarItem);

            Site.Assert.AreEqual<string>(
                "6",
                addCalendarResponse.AddResponses[0].Status,
                "The Sync command response should contain an airsync:Status element with a value of 6 when the CalendarType element is set to 13.");

            #endregion

            #region Call Sync command to add a calendar with the element Recurrence including CalendarType sub-element which is set as "16" to the server, and sync calendars from the server.

            calendarItem.Clear();

            // Set Calendar Recurrence element, CalendarType is set to "16".
            recurrence = this.CreateRecurrenceIncludingCalendarType(this.CreateCalendarRecurrence(recurrenceType, occurrences, interval), byte.Parse("16"));
            calendarItem.Add(Request.ItemsChoiceType8.Recurrence, recurrence);

            addCalendarResponse = this.AddSyncCalendar(calendarItem);

            Site.Assert.AreEqual<string>(
                "6",
                addCalendarResponse.AddResponses[0].Status,
                "The Sync command response should contain an airsync:Status element with a value of 6 when the CalendarType element is set to 16.");

            #endregion

            #region Call Sync command to add a calendar with the element Recurrence including CalendarType sub-element which is set as "17" to the server, and sync calendars from the server.

            calendarItem.Clear();

            // Set Calendar Recurrence element, CalendarType is set to "17".
            recurrence = this.CreateRecurrenceIncludingCalendarType(this.CreateCalendarRecurrence(recurrenceType, occurrences, interval), byte.Parse("17"));
            calendarItem.Add(Request.ItemsChoiceType8.Recurrence, recurrence);

            addCalendarResponse = this.AddSyncCalendar(calendarItem);

            Site.Assert.AreEqual<string>(
                "6",
                addCalendarResponse.AddResponses[0].Status,
                "The Sync command response should contain an airsync:Status element with a value of 6 when the CalendarType element is set to 17.");

            #endregion

            #region Call Sync command to add a calendar with the element Recurrence including CalendarType sub-element which is set as "18" to the server, and sync calendars from the server.

            calendarItem.Clear();

            // Set Calendar Recurrence element, CalendarType is set to "18".
            recurrence = this.CreateRecurrenceIncludingCalendarType(this.CreateCalendarRecurrence(recurrenceType, occurrences, interval), byte.Parse("18"));
            calendarItem.Add(Request.ItemsChoiceType8.Recurrence, recurrence);

            addCalendarResponse = this.AddSyncCalendar(calendarItem);

            Site.Assert.AreEqual<string>(
                "6",
                addCalendarResponse.AddResponses[0].Status,
                "The Sync command response should contain an airsync:Status element with a value of 6 when the CalendarType element is set to 18.");

            #endregion

            #region Call Sync command to add a calendar with the element Recurrence including CalendarType sub-element which is set as "19" to the server, and sync calendars from the server.

            calendarItem.Clear();

            // Set Calendar Recurrence element, CalendarType is set to "19".
            recurrence = this.CreateRecurrenceIncludingCalendarType(this.CreateCalendarRecurrence(recurrenceType, occurrences, interval), byte.Parse("19"));
            calendarItem.Add(Request.ItemsChoiceType8.Recurrence, recurrence);

            addCalendarResponse = this.AddSyncCalendar(calendarItem);

            Site.Assert.AreEqual<string>(
                "6",
                addCalendarResponse.AddResponses[0].Status,
                "The Sync command response should contain an airsync:Status element with a value of 6 when the CalendarType element is set to 19.");

            #endregion

            #region Call Sync command to add a calendar with the element Recurrence including CalendarType sub-element which is set as "21" to the server, and sync calendars from the server.

            calendarItem.Clear();

            // Set Calendar Recurrence element, CalendarType is set to "21".
            recurrence = this.CreateRecurrenceIncludingCalendarType(this.CreateCalendarRecurrence(recurrenceType, occurrences, interval), byte.Parse("21"));
            calendarItem.Add(Request.ItemsChoiceType8.Recurrence, recurrence);

            addCalendarResponse = this.AddSyncCalendar(calendarItem);

            Site.Assert.AreEqual<string>(
                "6",
                addCalendarResponse.AddResponses[0].Status,
                "The Sync command response should contain an airsync:Status element with a value of 6 when the CalendarType element is set to 21.");

            #endregion

            #region Call Sync command to add a calendar with the element Recurrence including CalendarType sub-element which is set as "22" to the server, and sync calendars from the server.

            calendarItem.Clear();

            // Set Calendar Recurrence element, CalendarType is set to "22".
            recurrence = this.CreateRecurrenceIncludingCalendarType(this.CreateCalendarRecurrence(recurrenceType, occurrences, interval), byte.Parse("22"));
            calendarItem.Add(Request.ItemsChoiceType8.Recurrence, recurrence);

            addCalendarResponse = this.AddSyncCalendar(calendarItem);

            Site.Assert.AreEqual<string>(
                "6",
                addCalendarResponse.AddResponses[0].Status,
                "The Sync command response should contain an airsync:Status element with a value of 6 when the CalendarType element is set to 22.");

            #endregion

            #region Call Sync command to add a calendar with the element Recurrence including CalendarType sub-element which is set as "23" to the server, and sync calendars from the server.

            calendarItem.Clear();

            // Set Calendar Recurrence element, CalendarType is set to "23".
            recurrence = this.CreateRecurrenceIncludingCalendarType(this.CreateCalendarRecurrence(recurrenceType, occurrences, interval), byte.Parse("23"));
            calendarItem.Add(Request.ItemsChoiceType8.Recurrence, recurrence);

            addCalendarResponse = this.AddSyncCalendar(calendarItem);

            Site.Assert.AreEqual<string>(
                "6",
                addCalendarResponse.AddResponses[0].Status,
                "The Sync command response should contain an airsync:Status element with a value of 6 when the CalendarType element is set to 23.");

            #endregion

            // According to above steps, requirement MS-ASCAL_R53913 can be covered directly.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCAL_R53913");

            // Verify MS-ASCAL requirement: MS-ASCAL_R53913
            Site.CaptureRequirement(
                53913,
                @"[In Sync Command Response][The Sync command response contains an airsync:Status element ([MS-ASCMD] section 2.2.3.162.16) with a value of 6 in the following cases:] The CalendarType element is set to one of the following values in the request: 13, 16, 17, 18, 19, 21, 22, or 23.");
        }