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

MSASCAL_S01_TC24_Status6WithDayOfMonth() private method

private MSASCAL_S01_TC24_Status6WithDayOfMonth ( ) : void
return void
        public void MSASCAL_S01_TC24_Status6WithDayOfMonth()
        {
            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 DayOfMonth 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 DayOfMonth
            recurrence.DayOfMonth = 10;
            recurrence.DayOfMonthSpecified = true;

            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 DayOfMonth 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 DayOfMonth 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 DayOfMonth
            recurrence.DayOfMonth = 10;
            recurrence.DayOfMonthSpecified = true;

            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 DayOfMonth 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 DayOfMonth sub-element when Type is '3' to the server, and sync calendars from the server.

            calendarItem.Clear();

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

            // Set DayOfMonth
            recurrence.DayOfMonth = 10;
            recurrence.DayOfMonthSpecified = true;

            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 DayOfMonth element is included in a request and the Type element value is set to 3.");

            #endregion

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

            calendarItem.Clear();

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

            // Set DayOfMonth
            recurrence.DayOfMonth = 10;
            recurrence.DayOfMonthSpecified = true;

            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 DayOfMonth element is included in a request and the Type element value is set to 6.");

            #endregion

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

            // Verify MS-ASCAL requirement: MS-ASCAL_R53916
            Site.CaptureRequirement(
                53916,
                @"[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 DayOfMonth element (section 2.2.2.12) is included in a request when the value of the Type element is not 2 or 5.");
        }