protected bool CheckUnexpectedMessageExist(uint folderHandle, ref uint contentsTableHandle, PropertyTag[] propertyTagList, string unexpectedPropertyValue, PropertyId propertyName = PropertyId.PidTagSubject)
{
bool doesUnexpectedMessageExist = false;
bool isExpectedPropertyInPropertyList = false;
RopGetContentsTableResponse ropGetContentTableResponse = this.OxoruleAdapter.RopGetContentsTable(folderHandle, ContentTableFlag.None, out contentsTableHandle);
Site.Assert.AreEqual<uint>(0, ropGetContentTableResponse.ReturnValue, "Getting contents table should succeed.");
RopQueryRowsResponse getNormalMailMessageContent = this.OxoruleAdapter.QueryPropertiesInTable(contentsTableHandle, propertyTagList);
Site.Assert.AreEqual<uint>(0, getNormalMailMessageContent.ReturnValue, "Getting mail message operation should succeed.");
if (getNormalMailMessageContent.RowData.Count > 0)
{
for (int i = 0; i < propertyTagList.Length; i++)
{
if (propertyTagList[i].PropertyId == (ushort)propertyName)
{
isExpectedPropertyInPropertyList = true;
for (int j = 0; j < getNormalMailMessageContent.RowData.PropertyRows.Count; j++)
{
string propertyValue = AdapterHelper.PropertyValueConvertToString(getNormalMailMessageContent.RowData.PropertyRows[j].PropertyValues[i].Value);
Site.Log.Add(LogEntryKind.Debug, "The value of the {0} property of the No.{1} message is : {2}", propertyName.ToString(), j + 1, propertyValue);
if (propertyValue.Contains(unexpectedPropertyValue))
{
doesUnexpectedMessageExist = true;
return doesUnexpectedMessageExist;
}
}
}
}
Site.Assert.IsTrue(isExpectedPropertyInPropertyList, "The property {0} to be checked should be included in the property list.", propertyName.ToString());
}
return doesUnexpectedMessageExist;
}