Class that allows comparison of two objects of the same type to each other. Supports classes, lists, arrays, dictionaries, child comparison and more. Source code is taken from http://comparenetobjects.codeplex.com/ All rights are reserved for the author.
        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");
        }