private void VerifyRopQueryRowsResponse(RopQueryRowsResponse queryRowsResponse, ushort rowCountRequest)
{
this.VerifyRPCLayerRequirement();
if (queryRowsResponse.RowCount > 0)
{
// The value of the following two properties are only valid for content table.
if (this.tableType == TableType.CONTENT_TABLE)
{
if (queryRowsResponse.RowData.PropertyRows != null)
{
for (int i = 0; i < queryRowsResponse.RowData.PropertyRows.Count; i++)
{
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R617");
// Verify MS-OXCTABL requirement: MS-OXCTABL_R617
Site.CaptureRequirementIfAreEqual<int>(
8,
queryRowsResponse.RowData.PropertyRows[i].PropertyValues[0].Value.Length,
617,
@"[In PidTagInstID] Data type: PtypInteger64 ([MS-OXCDATA] section 2.11.1).");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R618");
// Verify MS-OXCTABL requirement: MS-OXCTABL_R618
Site.CaptureRequirementIfAreEqual<int>(
4,
queryRowsResponse.RowData.PropertyRows[i].PropertyValues[1].Value.Length,
618,
@"[In PidTagInstanceNum] Data type: PtypInteger32 ([MS-OXCDATA] section 2.11.1).");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R619");
// Verify MS-OXCTABL requirement: MS-OXCTABL_R619
Site.CaptureRequirementIfAreEqual<int>(
4,
queryRowsResponse.RowData.PropertyRows[i].PropertyValues[3].Value.Length,
619,
@"[In PidTagRowType] Data type: PtypInteger32 ([MS-OXCDATA] section 2.11.1).");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R620");
// Verify MS-OXCTABL requirement: MS-OXCTABL_R620
Site.CaptureRequirementIfAreEqual<int>(
4,
queryRowsResponse.RowData.PropertyRows[i].PropertyValues[4].Value.Length,
620,
@"[In PidTagDepth] Data type: PtypInteger32 property ([MS-OXCDATA] section 2.11.1).");
}
}
if (!this.areMultipleSortOrders && this.isExpanded == true)
{
int i = 0;
uint tempRowType = 0;
bool isLeafRowExist = false;
for (; i < queryRowsResponse.RowData.PropertyRows.Count; i++)
{
tempRowType = BitConverter.ToUInt32(queryRowsResponse.RowData.PropertyRows[i].PropertyValues[3].Value, 0);
if (tempRowType == 0x01)
{
isLeafRowExist = true;
break;
}
}
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R15{0}", isLeafRowExist ? string.Empty : string.Format("There is no leaf row in the returned property rows!"));
// Verify MS-OXCTABL requirement: MS-OXCTABL_R15
Site.CaptureRequirementIfIsTrue(
isLeafRowExist,
15,
@"[In PidTagRowType] When the PidTagRowType is TBL_LEAF_ROW with value 0x00000001 means the row is a row of data.");
}
if (this.isExpanded == true)
{
int i = 0;
uint tempRowType = 0;
bool isExpandedHeaderExist = false;
for (; i < queryRowsResponse.RowData.PropertyRows.Count; i++)
{
tempRowType = BitConverter.ToUInt32(queryRowsResponse.RowData.PropertyRows[i].PropertyValues[3].Value, 0);
if (tempRowType == 0x03)
{
isExpandedHeaderExist = true;
break;
}
}
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R17{0}", isExpandedHeaderExist ? string.Empty : string.Format("There is no expanded header row in the returned property rows!"));
// Verify MS-OXCTABL requirement: MS-OXCTABL_R17
Site.CaptureRequirementIfIsTrue(
isExpandedHeaderExist,
17,
@"[In PidTagRowType] When the PidTagRowType is TBL_EXPANDED_CATEGORY with value 0x00000003 means the row is a header row that is expanded.");
}
else if ((!this.areMultipleSortOrders && this.areAllSortOrdersUsedAsCategory) || (this.areMultipleSortOrders && !this.areAllSortOrdersUsedAsCategory))
{
int i = 0;
uint tempRowType = 0;
bool isCollapsedHeaderExist = false;
for (; i < queryRowsResponse.RowData.PropertyRows.Count; i++)
{
tempRowType = BitConverter.ToUInt32(queryRowsResponse.RowData.PropertyRows[i].PropertyValues[3].Value, 0);
if (tempRowType == 0x04)
{
isCollapsedHeaderExist = true;
break;
}
}
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R18{0}", isCollapsedHeaderExist ? string.Empty : string.Format("There is no collapsed header row in the returned property rows!"));
// Verify MS-OXCTABL requirement: MS-OXCTABL_R18
Site.CaptureRequirementIfIsTrue(
isCollapsedHeaderExist,
18,
@"[In PidTagRowType] When the PidTagRowType is TBL_COLLAPSED_CATEGORY with value 0x00000004 means the row is a header row that is collapsed.");
}
// Since MS-OXCTABL_R15, MS-OXCTABL_R17 and MS-OXCTABL_R18 are verified, this requirement can be captured directly.
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R13");
// Verify MS-OXCTABL requirement: MS-OXCTABL_R13
Site.CaptureRequirement(
13,
@"[In PidTagRowType] The PidTagRowType property ([MS-OXPROPS] section 2.931) identifies the type of the row.");
if (this.areMultipleSortOrders && this.areAllSortOrdersUsedAsCategory && this.areAllCategoryExpanded)
{
int i = 0;
uint tempDepth = 0;
bool isCorrectDepth = false;
// There are no more than 2 categories in the response in this test suite.
for (; i < 3; i++)
{
tempDepth = BitConverter.ToUInt32(queryRowsResponse.RowData.PropertyRows[i].PropertyValues[4].Value, 0);
if (tempDepth == i)
{
isCorrectDepth = true;
}
else
{
break;
}
}
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R19{0}", isCorrectDepth ? string.Empty : string.Format(": The no.{0} row depth is not correct and the value is {1}!", i, tempDepth));
// Verify MS-OXCTABL requirement: MS-OXCTABL_R19
Site.CaptureRequirementIfIsTrue(
isCorrectDepth,
19,
@"[In PidTagDepth] The PidTagDepth property ([MS-OXPROPS] section 2.664) specifies the number of nested categories in which a given row is contained.");
}
}
}
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R110: the value of the Origin field in the response for RopQueryRows is set to {0}", queryRowsResponse.Origin);
// Verify MS-OXCTABL requirement: MS-OXCTABL_R110
bool isVerifyR110 = (queryRowsResponse.Origin == 0x00) ||
(queryRowsResponse.Origin == 0x01) ||
(queryRowsResponse.Origin == 0x02);
Site.CaptureRequirementIfIsTrue(
isVerifyR110,
110,
@"[In RopQueryRows ROP Response Buffer] This field [Origin] MUST be set to one of the predefined bookmark values[0x00,0x01,0x02] specified in section 2.2.2.1.1.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R109");
// Verify MS-OXCTABL requirement: MS-OXCTABL_R109
Site.CaptureRequirementIfAreEqual<Type>(
typeof(byte),
queryRowsResponse.Origin.GetType(),
109,
@"[In RopQueryRows ROP Response Buffer] Origin (1 byte): An enumeration that identifies the cursor position.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R111 (This is a WORD field)");
// Verify MS-OXCTABL requirement: MS-OXCTABL_R111
Site.CaptureRequirementIfAreEqual<Type>(
typeof(ushort),
queryRowsResponse.RowCount.GetType(),
111,
@"[In RopQueryRows ROP Response Buffer] RowCount (2 bytes): An unsigned integer that specifies the number of rows returned.");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R112", rowCountRequest);
// Verify MS-OXCTABL requirement: MS-OXCTABL_R112
bool isVerifyR112 = (queryRowsResponse.RowCount <= rowCountRequest) &&
(queryRowsResponse.RowCount >= 0x0000);
Site.CaptureRequirementIfIsTrue(
isVerifyR112,
112,
@"[In RopQueryRows ROP Response Buffer] Its [RowCount's] value MUST be less than or equal to the RowCount field value that is specified in the request, and it MUST be greater than or equal to 0x0000.");
if (queryRowsResponse.RowData.PropertyRows != null)
{
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R113");
// Verify MS-OXCTABL requirement: MS-OXCTABL_R113
Site.CaptureRequirementIfAreEqual<ushort>(
(ushort)queryRowsResponse.RowData.PropertyRows.Count,
queryRowsResponse.RowCount,
113,
@"[In RopQueryRows ROP Response Buffer] It [RowCount] MUST be equal to the number of PropertyRow objects returned in the RowData field.");
// If the propertyRows count in the queryrowsResponse is not zero, this requirement can be covered
if (queryRowsResponse.RowData.PropertyRows.Count > 0)
{
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R114");
// Verify MS-OXCTABL requirement: MS-OXCTABL_R114
Site.CaptureRequirement(
114,
@"[In RopQueryRows ROP Response Buffer] RowData (variable): A list of PropertyRow structures that contains the array of rows returned.");
}
for (int i = 0; i < queryRowsResponse.RowData.PropertyRows.Count; i++)
{
int totalSize = 0;
for (int j = 0; j < queryRowsResponse.RowData.PropertyRows[i].PropertyValues.Count; j++)
{
if (queryRowsResponse.RowData.PropertyRows[i].PropertyValues[j].Value == null)
{
continue;
}
if (queryRowsResponse.RowData.PropertyRows[i].PropertyValues[j].Value != null)
{
totalSize += queryRowsResponse.RowData.PropertyRows[i].PropertyValues[j].Size();
}
}
bool isVerifyR121 = totalSize <= 510 * sizeof(byte);
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R121", 510 * sizeof(byte));
// Verify MS-OXCTABL requirement: MS-OXCTABL_R121
Site.CaptureRequirementIfIsTrue(
isVerifyR121,
121,
@"[In RopQueryRows ROP Response Buffer] Every property value returned in a row MUST be less than or equal to 510 bytes in size.");
}
foreach (PropertyRow propertyRow in queryRowsResponse.RowData.PropertyRows)
{
this.VerifyPropertyRowStructure(propertyRow);
}
}
else
{
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R113");
// Verify MS-OXCTABL requirement: MS-OXCTABL_R113
Site.CaptureRequirementIfAreEqual<ushort>(
0,
queryRowsResponse.RowCount,
113,
@"[In RopQueryRows ROP Response Buffer] It [RowCount] MUST be equal to the number of PropertyRow objects returned in the RowData field.");
}
for (int i = 0; i < queryRowsResponse.RowCount; i++)
{
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R115");
// Verify MS-OXCTABL requirement: MS-OXCTABL_R115
Site.CaptureRequirementIfAreEqual<Type>(
typeof(PropertyRow),
queryRowsResponse.RowData.PropertyRows[i].GetType(),
115,
@"[In RopQueryRows ROP Response Buffer] Each row is represented by a PropertyRow object, as specified in [MS-OXCDATA] section 2.8.1.");
}
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCTABL_R463: the value of the RowCount field in the response for RopQueryRows is set to {0}", queryRowsResponse.RowCount);
// Verify MS-OXCTABL requirement: MS-OXCTABL_R463
bool isVerifyR463 = queryRowsResponse.RowCount <= rowCountRequest;
Site.CaptureRequirementIfIsTrue(
isVerifyR463,
463,
@"[In Processing RopQueryRows] The number of rows sent in the ROP response MUST be less than or equal to the number of rows specified in the RowCount field.");
}