/// <summary> /// Compares the specified object graphs. It is called by <see cref="ObjectGraphComparer"/>. /// </summary> /// <param name="left">The left.</param> /// <param name="right">The right.</param> /// <param name="comparer"> /// The calling comparer to compare object sub-graphs, which the given strategy does /// not work with and perform other interactions. /// </param> /// <returns> /// <c>true</c> if the specified nodes are equal; otherwise, <c>false</c>. /// </returns> internal bool Compare(GraphNode left, GraphNode right, ObjectGraphComparer comparer) { Debug.Assert(left != null); Debug.Assert(right != null); Debug.Assert(comparer != null); EnterCompare(comparer); try { var mismatches = Compare(left, right); if (mismatches != null) { ComparisonResult &= !mismatches.Any(); foreach (var m in mismatches) { Comparer.AddMismatch(m); } } return(ComparisonResult); } finally { ExitCompare(); } }