Compare() public method

Compare two objects of the same type to each other.
Check the Differences or DifferencesString Properties for the differences. Default MaxDifferences is 1 for performance
public Compare ( object object1, object object2 ) : bool
object1 object
object2 object
return bool
Beispiel #1
0
        public static string FindDifferences(object expected, object actual)
        {
            var compare = new CompareObjects
            {
                MaxDifferences = 10
            };


            if (compare.Compare(expected, actual))
            {
                return(null);
            }

            return(compare.DifferencesString
                   .Trim('\r', '\n')
                   .Replace("object1", "expected")
                   .Replace("object2", "actual"));
        }
        public static string FindDifferences(object expected, object actual)
        {
            var compare = new CompareObjects
            {
                MaxDifferences = 10
            };

            if (compare.Compare(expected, actual))
                return null;

            return compare.DifferencesString
                .Trim('\r', '\n')
                .Replace("object1", "expected")
                .Replace("object2", "actual");
        }