public bool AreEqual(object expected, object actual, IComparisonContext comparisonContext)
        {
            const bool equal    = true;
            var        areEqual = comparisonContext.CompareProperties(expected, actual,
                                                                      (pi, actualPropertyInfo) =>
                                                                      CompareProperty(pi, actualPropertyInfo, expected, actual,
                                                                                      comparisonContext, equal));

            areEqual = comparisonContext.CompareFields(expected, actual,
                                                       (fi, actualFieldInfo) =>
                                                       CompareField(fi, actualFieldInfo, expected, actual, comparisonContext)) && areEqual;

            return(areEqual);
        }
        public bool AreEqual(object expected, object actual, IComparisonContext comparisonContext)
        {
            const bool equal = true;
            bool areEqual = comparisonContext.CompareProperties(expected, actual,
                                                                (pi, actualPropertyInfo) =>
                                                                CompareProperty(pi, actualPropertyInfo, expected, actual,
                                                                                comparisonContext, equal));

            areEqual = comparisonContext.CompareFields(expected, actual,
                                                               (fi, actualFieldInfo) =>
                                                               CompareField(fi, actualFieldInfo, expected, actual,
                                                                               comparisonContext, equal)) && areEqual;

            return areEqual;
        }
Exemple #3
0
        public bool AreEqual(object expected, object actual, IComparisonContext comparisonContext)
        {
            const bool equal    = true;
            bool       areEqual = comparisonContext.CompareProperties(expected, actual,
                                                                      (pi, actualPropertyInfo) =>
            {
                //we ignore context, it's not relevant
                if (pi.Name == "Context")
                {
                    return(true);
                }
                return(CompareProperty(pi, actualPropertyInfo, expected, actual,
                                       comparisonContext, equal));
            });

            areEqual = comparisonContext.CompareFields(expected, actual,
                                                       (fi, actualFieldInfo) =>
                                                       CompareField(fi, actualFieldInfo, expected, actual,
                                                                    comparisonContext, equal)) && areEqual;

            return(areEqual);
        }