示例#1
0
        public bool Compare(TestObject other, bool verbose)
        {
            var result = ThisIsaField == other.ThisIsaField;
            result &= AndThisIsAProperty == other.AndThisIsAProperty;
            result &= AString == other.AString;
            result &= AndALargeNumber == other.AndALargeNumber;
            result &= (Array == null && other.Array == null) || (Array != null && other.Array != null);

            if (null != Array && null != other.Array)
            {
                for (var i = 0; i < Array.Length && i < other.Array.Length; ++i)
                    result &= Array[i] == other.Array[i];
            }
            if (verbose)
            {
                Console.WriteLine("ThisIsAField:");
                Console.WriteLine("Me: {0}, Them: {1}", ThisIsaField, other.ThisIsaField);
                Console.WriteLine("AndThisIsAProperty:");
                Console.WriteLine("Me: {0}, Them: {1}", AndThisIsAProperty, other.AndThisIsAProperty);
                Console.WriteLine("AString:");
                Console.WriteLine("Me: {0}, Them: {1}", AString, other.AString);
                Console.WriteLine("AndALargeNumber:");
                Console.WriteLine("Me: {0}, Them: {1}", AndALargeNumber, other.AndALargeNumber);
                Console.WriteLine("Array:");
                Console.WriteLine("Me: {0}, Them: {1}", Array.CombineToString(), other.Array.CombineToString());
            }
            result &= ClassProperty.Compare(other.ClassProperty, verbose);
            return result;
        }