public void MSASCMD_S07_TC05_GetItemEstimate_Calendar_FilterType()
{
Site.Assume.AreNotEqual<string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The Options 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.");
Site.Assume.AreNotEqual<string>("16.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "Recurrences cannot be added in protocol version 16.0");
#region Add a new calendar
string calendarSubject = Common.GenerateResourceName(Site, "calendarSubject");
DateTime startTime = DateTime.Now.AddDays(1.0);
DateTime endTime = startTime.AddMinutes(10.0);
Request.SyncCollectionAdd calendarData = new Request.SyncCollectionAdd
{
ClientId = TestSuiteBase.ClientId,
ApplicationData = new Request.SyncCollectionAddApplicationData
{
ItemsElementName =
new Request.ItemsChoiceType8[]
{
Request.ItemsChoiceType8.Subject,
Request.ItemsChoiceType8.StartTime,
Request.ItemsChoiceType8.EndTime
},
Items =
new object[]
{
calendarSubject,
startTime.ToString("yyyyMMddTHHmmssZ"),
endTime.ToString("yyyyMMddTHHmmssZ")
}
},
Class = "Calendar"
};
this.Sync(TestSuiteBase.CreateEmptySyncRequest(this.User1Information.CalendarCollectionId));
SyncRequest syncRequest = TestSuiteBase.CreateSyncAddRequest(this.LastSyncKey, this.User1Information.CalendarCollectionId, calendarData);
SyncResponse syncResponse = this.Sync(syncRequest);
Response.SyncCollectionsCollectionResponses responses = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Responses) as Response.SyncCollectionsCollectionResponses;
Site.Assert.AreEqual<int>(1, int.Parse(responses.Add[0].Status), "The calendar should be added successfully.");
TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.CalendarCollectionId, calendarSubject);
#endregion
#region Call GetItemEstimate with FilterType setting to 0 to get estimate number of all items in Calendar folder.
GetItemEstimateResponse getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User1Information.CalendarCollectionId, (byte)0);
Site.Assert.IsNotNull(getItemEstimateResponse.ResponseData.Response, "The response of GetItemEstimate command should not be null.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3008");
// Verify MS-ASCMD requirement: MS-ASCMD_R3008
Site.CaptureRequirementIfAreEqual<int>(
1,
int.Parse(getItemEstimateResponse.ResponseData.Response[0].Status),
3008,
@"[In FilterType(GetItemEstimate)] Yes. [Applies to calendar, if FilterType is 0, Status element value is 1.]");
#endregion
#region Call GetItemEstimate with FilterType setting to 1 to get estimate number of items within 1 day in Calendar folder.
getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User1Information.CalendarCollectionId, (byte)1);
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3009");
// Verify MS-ASCMD requirement: MS-ASCMD_R3009
Site.CaptureRequirementIfAreEqual<int>(
110,
int.Parse(getItemEstimateResponse.ResponseData.Status),
3009,
@"[In FilterType(GetItemEstimate)] No, [Applies to calendar, if FilterType is 1,] Status element (section 2.2.3.162.6) value is 110.");
#endregion
#region Call GetItemEstimate with FilterType setting to 2 to get estimate number of items within 3 days in Calendar folder.
getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User1Information.CalendarCollectionId, (byte)2);
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3010");
// Verify MS-ASCMD requirement: MS-ASCMD_R3010
Site.CaptureRequirementIfAreEqual<int>(
110,
int.Parse(getItemEstimateResponse.ResponseData.Status),
3010,
@"[In FilterType(GetItemEstimate)] No, [Applies to calendar, if FilterType is 2,] Status element value is 110.");
#endregion
#region Call GetItemEstimate with FilterType setting to 3 to get estimate number of items within 1 week in Calendar folder.
getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User1Information.CalendarCollectionId, (byte)3);
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3011");
// Verify MS-ASCMD requirement: MS-ASCMD_R3011
Site.CaptureRequirementIfAreEqual<int>(
110,
int.Parse(getItemEstimateResponse.ResponseData.Status),
3011,
@"[In FilterType(GetItemEstimate)] No, [Applies to calendar, if FilterType is 3,] Status element value is 110.");
#endregion
#region Call GetItemEstimate with FilterType setting to 4 to get estimate number of items within 2 weeks in Calendar folder.
getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User1Information.CalendarCollectionId, (byte)4);
Site.Assert.IsNotNull(getItemEstimateResponse.ResponseData.Response, "The response of GetItemEstimate command should not be null.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3012");
// Verify MS-ASCMD requirement: MS-ASCMD_R3012
Site.CaptureRequirementIfAreEqual<int>(
1,
int.Parse(getItemEstimateResponse.ResponseData.Response[0].Status),
3012,
@"[In FilterType(GetItemEstimate)] Yes. [Applies to calendar, if FilterType is 4, Status element value 1]");
#endregion
#region Create a future calendar
this.GetInitialSyncResponse(this.User1Information.CalendarCollectionId);
calendarSubject = Common.GenerateResourceName(this.Site, "canlendarSubject");
startTime = DateTime.Now.AddDays(15.0);
endTime = startTime.AddMinutes(10.0);
calendarData = new Request.SyncCollectionAdd
{
ClientId = TestSuiteBase.ClientId,
ApplicationData = new Request.SyncCollectionAddApplicationData
{
ItemsElementName = new Request.ItemsChoiceType8[]
{
Request.ItemsChoiceType8.Subject,
Request.ItemsChoiceType8.StartTime,
Request.ItemsChoiceType8.EndTime,
},
Items = new object[]
{
calendarSubject,
startTime.ToString("yyyyMMddTHHmmssZ"),
endTime.ToString("yyyyMMddTHHmmssZ"),
}
},
Class = "Calendar"
};
syncRequest = TestSuiteBase.CreateSyncAddRequest(this.LastSyncKey, this.User1Information.CalendarCollectionId, calendarData);
syncResponse = this.Sync(syncRequest);
Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");
responses = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Responses) as Response.SyncCollectionsCollectionResponses;
Site.Assert.AreEqual<int>(1, int.Parse(responses.Add[0].Status), "The calendar should be added successfully.");
TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.CalendarCollectionId, calendarSubject);
syncResponse = this.SyncChanges(this.User1Information.CalendarCollectionId);
Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");
bool isVerifyR2971 = !string.IsNullOrEmpty(TestSuiteBase.FindServerId(syncResponse, "Subject", calendarSubject));
syncRequest = TestSuiteBase.CreateEmptySyncRequest(this.User1Information.CalendarCollectionId, 4);
this.Sync(syncRequest);
syncRequest.RequestData.Collections[0].SyncKey = this.LastSyncKey;
syncResponse = this.Sync(syncRequest);
Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");
isVerifyR2971 = isVerifyR2971 && !string.IsNullOrEmpty(TestSuiteBase.FindServerId(syncResponse, "Subject", calendarSubject));
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2971");
// Verify MS-ASCMD requirement: MS-ASCMD_R2971
Site.CaptureRequirementIfIsTrue(
isVerifyR2971,
2971,
@"[In FilterType(GetItemEstimate)] Calendar items that are in the future [or that have recurrence, but no end date], are sent to the client regardless of the airsync:FilterType element value.");
#endregion
#region Create a recurrence calendar without EndTime
string recurrenceCalendarSubject = Common.GenerateResourceName(Site, "recurrenceCanlendarSubject");
Request.SyncCollectionAdd recurrenceCalendarData = new Request.SyncCollectionAdd
{
ClientId = TestSuiteBase.ClientId,
ApplicationData = new Request.SyncCollectionAddApplicationData
{
ItemsElementName = new Request.ItemsChoiceType8[] { Request.ItemsChoiceType8.Subject, Request.ItemsChoiceType8.Recurrence },
Items = new object[]
{
recurrenceCalendarSubject,
new Request.Recurrence
{
Type = 1,
OccurrencesSpecified = false,
DayOfWeek = 2,
DayOfWeekSpecified = true,
IsLeapMonthSpecified = false
},
}
},
Class = "Calendar"
};
syncRequest = TestSuiteBase.CreateSyncAddRequest(this.LastSyncKey, this.User1Information.CalendarCollectionId, recurrenceCalendarData);
syncResponse = this.Sync(syncRequest);
responses = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Responses) as Response.SyncCollectionsCollectionResponses;
Site.Assert.AreEqual<int>(1, int.Parse(responses.Add[0].Status), "The calendar should be added successfully.");
TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.CalendarCollectionId, recurrenceCalendarSubject);
syncResponse = this.SyncChanges(this.User1Information.CalendarCollectionId);
Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");
bool isVerifyR5877 = !string.IsNullOrEmpty(TestSuiteBase.FindServerId(syncResponse, "Subject", recurrenceCalendarSubject));
syncRequest = TestSuiteBase.CreateEmptySyncRequest(this.User1Information.CalendarCollectionId, 4);
this.Sync(syncRequest);
syncRequest.RequestData.Collections[0].SyncKey = this.LastSyncKey;
syncResponse = this.Sync(syncRequest);
Site.Assert.IsNotNull(syncResponse.ResponseData.Item, "The items returned in the Sync command response should not be null.");
isVerifyR5877 = isVerifyR5877 && !string.IsNullOrEmpty(TestSuiteBase.FindServerId(syncResponse, "Subject", recurrenceCalendarSubject));
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5877");
// Verify MS-ASCMD requirement: MS-ASCMD_R5877
Site.CaptureRequirementIfIsTrue(
isVerifyR5877,
5877,
@"[In FilterType(GetItemEstimate)] Calendar items [that are in the future or] that have recurrence, but no end date, are sent to the client regardless of the airsync:FilterType element value.");
#endregion
#region Call GetItemEstimate with FilterType setting to 5 to get estimate number of items within 1 month in Calendar folder.
getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User1Information.CalendarCollectionId, (byte)5);
Site.Assert.IsNotNull(getItemEstimateResponse.ResponseData.Response, "The response of GetItemEstimate command should not be null.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3013");
// Verify MS-ASCMD requirement: MS-ASCMD_R3013
Site.CaptureRequirementIfAreEqual<int>(
1,
int.Parse(getItemEstimateResponse.ResponseData.Response[0].Status),
3013,
@"[In FilterType(GetItemEstimate)] Yes. [Applies to calendar, if FilterType is 5, Status element value is 1.]");
#endregion
#region Call GetItemEstimate with FilterType setting to 6 to get estimate number of items within 3 months in Calendar folder.
getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User1Information.CalendarCollectionId, (byte)6);
Site.Assert.IsNotNull(getItemEstimateResponse.ResponseData.Response, "The response of GetItemEstimate command should not be null.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3014");
// Verify MS-ASCMD requirement: MS-ASCMD_R3014
Site.CaptureRequirementIfAreEqual<int>(
1,
int.Parse(getItemEstimateResponse.ResponseData.Response[0].Status),
3014,
@"[In FilterType(GetItemEstimate)] Yes. [Applies to calendar, if FilterType is 6, Status element value 1]");
#endregion
#region Call GetItemEstimate with FilterType setting to 7 to get estimate number of items within 6 months in Calendar folder.
getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User1Information.CalendarCollectionId, (byte)7);
Site.Assert.IsNotNull(getItemEstimateResponse.ResponseData.Response, "The response of GetItemEstimate command should not be null.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3015");
// Verify MS-ASCMD requirement: MS-ASCMD_R3015
Site.CaptureRequirementIfAreEqual<int>(
1,
int.Parse(getItemEstimateResponse.ResponseData.Response[0].Status),
3015,
@"[In FilterType(GetItemEstimate)] Yes. [Applies to calendar, if FilterType is 7, Status element value is 1.]");
#endregion
#region Call GetItemEstimate with FilterType setting to 8 to get estimate number of incomplete tasks in Calendar folder.
getItemEstimateResponse = this.GetItemEstimateWithFilterType(this.User1Information.CalendarCollectionId, (byte)8);
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3016");
// Verify MS-ASCMD requirement: MS-ASCMD_R3016
Site.CaptureRequirementIfAreEqual<int>(
110,
int.Parse(getItemEstimateResponse.ResponseData.Status),
3016,
@"[In FilterType(GetItemEstimate)] No, [Applies to calendar, if FilterType is 8,] Status element value is 110.");
#endregion
}