Beispiel #1
0
        public static bool?Equal(object x, object y, ref Tolerance tolerance, ComparisonState state, NUnitEqualityComparer equalityComparer)
        {
            if (!x.GetType().IsArray || !y.GetType().IsArray || equalityComparer.CompareAsCollection)
            {
                return(null);
            }

            Array xArray = (Array)x;
            Array yArray = (Array)y;

            int rank = xArray.Rank;

            if (rank != yArray.Rank)
            {
                return(false);
            }

            for (int r = 1; r < rank; r++)
            {
                if (xArray.GetLength(r) != yArray.GetLength(r))
                {
                    return(false);
                }
            }

            return(EnumerablesComparer.Equal(xArray, yArray, ref tolerance, state, equalityComparer));
        }
Beispiel #2
0
 internal ArraysComparer(NUnitEqualityComparer equalityComparer, EnumerablesComparer enumerablesComparer)
 {
     _equalityComparer    = equalityComparer;
     _enumerablesComparer = enumerablesComparer;
 }