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

MSASCAL_S01_TC27_Status6WithWeekOfMonth() private method

private MSASCAL_S01_TC27_Status6WithWeekOfMonth ( ) : void
return void
        public void MSASCAL_S01_TC27_Status6WithWeekOfMonth()
        {
            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 Call Sync command to add a calendar with the element Recurrence including WeekOfMonth sub-element when Type is '0' to the server, and sync calendars from the server.

            Dictionary<Request.ItemsChoiceType8, object> calendarItem = new Dictionary<Request.ItemsChoiceType8, object>();

            // Set Calendar Recurrence element
            byte recurrenceType = byte.Parse("0");
            Request.Recurrence recurrence = this.CreateCalendarRecurrence(recurrenceType, 3, 3);

            // Set WeekOfMonth
            recurrence.WeekOfMonthSpecified = true;
            recurrence.WeekOfMonth = 3;

            calendarItem.Add(Request.ItemsChoiceType8.Recurrence, recurrence);

            SyncStore addCalendarResponse1 = this.AddSyncCalendar(calendarItem);

            Site.Assert.AreEqual<string>(
                "6",
                addCalendarResponse1.AddResponses[0].Status,
                "The Sync command response should contain an airsync:Status element with a value of 6 when the WeekOfMonth element is included in a request and the Type element value is set to 0.");

            #endregion

            #region Call Sync command to add a calendar with the element Recurrence including WeekOfMonth sub-element when Type is '1' to the server, and sync calendars from the server.

            calendarItem.Clear();

            // Set Calendar Recurrence element
            recurrenceType = byte.Parse("1");
            recurrence = this.CreateCalendarRecurrence(recurrenceType, 3, 3);

            // Set WeekOfMonth
            recurrence.WeekOfMonthSpecified = true;
            recurrence.WeekOfMonth = 3;

            calendarItem.Add(Request.ItemsChoiceType8.Recurrence, recurrence);

            SyncStore addCalendarResponse2 = this.AddSyncCalendar(calendarItem);

            Site.Assert.AreEqual<string>(
                "6",
                addCalendarResponse2.AddResponses[0].Status,
                "The Sync command response should contain an airsync:Status element with a value of 6 when the WeekOfMonth element is included in a request and the Type element value is set to 1.");

            #endregion

            #region Call Sync command to add a calendar with the element Recurrence including WeekOfMonth sub-element when Type is '2' to the server, and sync calendars from the server.

            calendarItem.Clear();

            // Set Calendar Recurrence element
            recurrenceType = byte.Parse("2");
            recurrence = this.CreateCalendarRecurrence(recurrenceType, 3, 3);

            // Set WeekOfMonth
            recurrence.WeekOfMonthSpecified = true;
            recurrence.WeekOfMonth = 3;

            calendarItem.Add(Request.ItemsChoiceType8.Recurrence, recurrence);

            SyncStore addCalendarResponse3 = this.AddSyncCalendar(calendarItem);

            Site.Assert.AreEqual<string>(
                "6",
                addCalendarResponse3.AddResponses[0].Status,
                "The Sync command response should contain an airsync:Status element with a value of 6 when the WeekOfMonth element is included in a request and the Type element value is set to 2.");

            #endregion

            #region Call Sync command to add a calendar with the element Recurrence including WeekOfMonth sub-element when Type is '5' to the server, and sync calendars from the server.

            calendarItem.Clear();

            // Set Calendar Recurrence element
            recurrenceType = byte.Parse("5");
            recurrence = this.CreateCalendarRecurrence(recurrenceType, 3, 3);

            // Set WeekOfMonth
            recurrence.WeekOfMonthSpecified = true;
            recurrence.WeekOfMonth = 3;

            calendarItem.Add(Request.ItemsChoiceType8.Recurrence, recurrence);

            SyncStore addCalendarResponse4 = this.AddSyncCalendar(calendarItem);

            Site.Assert.AreEqual<string>(
                "6",
                addCalendarResponse4.AddResponses[0].Status,
                "The Sync command response should contain an airsync:Status element with a value of 6 when the WeekOfMonth element is included in a request and the Type element value is set to 5.");

            #endregion

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

            // Verify MS-ASCAL requirement: MS-ASCAL_R53919
            Site.CaptureRequirement(
                53919,
                @"[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 WeekOfMonth element (section 2.2.2.46) is included in a request when the value of the Type element is not 3 or 6.");
        }