void CompareIndexer(PropertyInfo info, object object1, object object2, string breadCrumb)
{
string currentCrumb;
int indexerCount1 =
(int) info.ReflectedType.GetProperty("Count").GetGetMethod().Invoke(object1, new object[] {});
int indexerCount2 =
(int) info.ReflectedType.GetProperty("Count").GetGetMethod().Invoke(object2, new object[] {});
//Indexers must be the same length
if (indexerCount1 != indexerCount2)
{
currentCrumb = AddBreadCrumb(breadCrumb, info.Name, string.Empty, -1);
Differences.Add(string.Format("object1{0}.Count != object2{0}.Count ({1},{2})", currentCrumb,
indexerCount1, indexerCount2));
if (Differences.Count >= MaxDifferences)
return;
}
// Run on indexer
for (int i = 0; i < indexerCount1; i++)
{
currentCrumb = AddBreadCrumb(breadCrumb, info.Name, string.Empty, i);
object objectValue1 = info.GetValue(object1, new object[] {i});
object objectValue2 = info.GetValue(object2, new object[] {i});
Compare(objectValue1, objectValue2, currentCrumb);
if (Differences.Count >= MaxDifferences)
return;
}
}