public SetVerificationGrammar Columns(Action<IDataRowComparer> action) { var comparer = new DataRowComparer(); action(comparer); var grammar = new SetVerificationGrammar(_stepName, _title, comparer) { Description = _description }; if (_dataSource != null) { grammar.Before((step, context) => { context.CurrentObject = _dataSource(context).Rows; }); } return grammar; }
private static bool CompareArray(Array a, Array b) { if ((null == b) || (1 != a.Rank) || (1 != b.Rank) || (a.Length != b.Length)) { // automatically consider array's with Rank>1 not-equal return(false); } int index1 = a.GetLowerBound(0); int index2 = b.GetLowerBound(0); if (a.GetType() == b.GetType() && (0 == index1) && (0 == index2)) { switch (Type.GetTypeCode(a.GetType().GetElementType())) { case TypeCode.Byte: return(DataRowComparer.CompareEquatableArray <Byte>((Byte[])a, (Byte[])b)); case TypeCode.Int16: return(DataRowComparer.CompareEquatableArray <Int16>((Int16[])a, (Int16[])b)); case TypeCode.Int32: return(DataRowComparer.CompareEquatableArray <Int32>((Int32[])a, (Int32[])b)); case TypeCode.Int64: return(DataRowComparer.CompareEquatableArray <Int64>((Int64[])a, (Int64[])b)); case TypeCode.String: return(DataRowComparer.CompareEquatableArray <String>((String[])a, (String[])b)); } } //Compare every element. But don't recurse if we have Array of array. int length = index1 + a.Length; for (; index1 < length; ++index1, ++index2) { if (!AreElementEqual(a.GetValue(index1), b.GetValue(index2))) { return(false); } } return(true); }