public void MSASCAL_S01_TC16_RecurrenceWithType6()
{
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 Generate calendar subject and record them.
byte recurrenceType = byte.Parse("6");
Dictionary<Request.ItemsChoiceType8, object> calendarItem = new Dictionary<Request.ItemsChoiceType8, object>();
List<SyncItem> calendars = new List<SyncItem>();
string subjectWithType6AndOccurrences = Common.GenerateResourceName(Site, "subjectWithType6AndOccurrences");
string subjectWithType6AndUntil = Common.GenerateResourceName(Site, "subjectWithType6AndUntil");
string subjectWithType6Only = Common.GenerateResourceName(Site, "subjectWithType6Only");
#endregion
#region Call Sync command to add a calendar with the element Recurrence including Type '6' and Occurrences sub-element to the server, and sync calendars from the server.
// Add Calendar Recurrence element including Occurrences sub-element
int occurrences = 3;
int interval = 1;
Request.Recurrence recurrence = this.CreateCalendarRecurrence(recurrenceType, occurrences, interval);
recurrence.WeekOfMonth = 5;
recurrence.WeekOfMonthSpecified = true;
calendarItem.Add(Request.ItemsChoiceType8.Recurrence, recurrence);
calendarItem.Add(Request.ItemsChoiceType8.Subject, subjectWithType6AndOccurrences);
this.AddSyncCalendar(calendarItem);
SyncItem calendarWithType6AndOccurrences = this.GetChangeItem(this.User1Information.CalendarCollectionId, subjectWithType6AndOccurrences);
Site.Assert.IsNotNull(calendarWithType6AndOccurrences.Calendar, "The calendar with subject {0} should exist in server.", subjectWithType6AndOccurrences);
this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.CalendarCollectionId, subjectWithType6AndOccurrences);
calendars.Add(calendarWithType6AndOccurrences);
#endregion
#region Call Sync command to add a calendar with the element Recurrence including Type '6' and Until sub-element to the server, and sync calendars from the server.
calendarItem.Clear();
// Set Calendar Recurrence element including Until sub-element
recurrence = this.CreateCalendarRecurrence(recurrenceType, 0, interval);
recurrence.Until = this.FutureTime.AddYears(5).ToString("yyyyMMddTHHmmssZ");
recurrence.WeekOfMonth = 5;
recurrence.WeekOfMonthSpecified = true;
calendarItem.Add(Request.ItemsChoiceType8.Recurrence, recurrence);
calendarItem.Add(Request.ItemsChoiceType8.Subject, subjectWithType6AndUntil);
this.AddSyncCalendar(calendarItem);
SyncItem calendarWithType6AndUntil = this.GetChangeItem(this.User1Information.CalendarCollectionId, subjectWithType6AndUntil);
Site.Assert.IsNotNull(calendarWithType6AndUntil.Calendar, "The calendar with subject {0} should exist in server.", subjectWithType6AndUntil);
this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.CalendarCollectionId, subjectWithType6AndUntil);
calendars.Add(calendarWithType6AndUntil);
#endregion
#region Call Sync command to add a calendar with the element Recurrence only including Type '6' to the server, and sync calendars from the server.
calendarItem.Clear();
// Set Calendar Recurrence element without Occurrences and Until sub-element
recurrence = this.CreateCalendarRecurrence(recurrenceType, 1, interval);
recurrence.OccurrencesSpecified = false;
recurrence.Until = null;
recurrence.WeekOfMonth = 5;
recurrence.WeekOfMonthSpecified = true;
calendarItem.Add(Request.ItemsChoiceType8.Recurrence, recurrence);
calendarItem.Add(Request.ItemsChoiceType8.Subject, subjectWithType6Only);
this.AddSyncCalendar(calendarItem);
SyncItem calendarWithType6Only = this.GetChangeItem(this.User1Information.CalendarCollectionId, subjectWithType6Only);
Site.Assert.IsNotNull(calendarWithType6Only.Calendar, "The calendar with subject {0} should exist in server.", subjectWithType6Only);
this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.CalendarCollectionId, subjectWithType6Only);
calendars.Add(calendarWithType6Only);
#endregion
foreach (SyncItem response in calendars)
{
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCAL_R19514");
// Verify MS-ASCAL requirement: MS-ASCAL_R19514
Site.CaptureRequirementIfIsFalse(
response.Calendar.Recurrence.DayOfMonthSpecified,
19514,
@"[In DayOfMonth] The DayOfMonth element MUST NOT be included in responses when the Type element value is 6.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCAL_R32312");
// Verify MS-ASCAL requirement: MS-ASCAL_R32312
Site.CaptureRequirementIfIsTrue(
response.Calendar.Recurrence.MonthOfYearSpecified,
32312,
@"[In MonthOfYear] A command response has a minimum of one MonthOfYear child element per Recurrence element if the value of the Type element (section 2.2.2.43) is 6.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCAL_R47312");
// Verify MS-ASCAL requirement: MS-ASCAL_R47312
Site.CaptureRequirementIfIsTrue(
response.Calendar.Recurrence.WeekOfMonthSpecified,
47312,
@"[In WeekOfMonth] A command response has a minimum of one WeekOfMonth child element per Recurrence element when the value of the Type element (section 2.2.2.43) is 6.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCAL_R459");
// Verify MS-ASCAL requirement: MS-ASCAL_R459
Site.CaptureRequirementIfAreEqual<byte>(
recurrenceType,
response.Calendar.Recurrence.Type,
459,
@"[In Type] [The value 6 means] Recurs yearly on the nth day.");
if (!this.IsActiveSyncProtocolVersion121)
{
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCAL_R14313");
// Verify MS-ASCAL requirement: MS-ASCAL_R14313
Site.CaptureRequirementIfIsTrue(
response.Calendar.Recurrence.CalendarTypeSpecified,
14313,
@"[In CalendarType] A command response has a minimum of one CalendarType child element per Recurrence element when the Type element value is 6.");
}
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCAL_R477");
// Verify MS-ASCAL requirement: MS-ASCAL_R477
Site.CaptureRequirementIfAreEqual<byte>(
5,
response.Calendar.Recurrence.WeekOfMonth,
477,
@"[In WeekOfMonth] The value of 5 specifies the last week of the month.");
}
}