public void GivenMemberInitsWhenComparedThenAreSimilarShouldReturnResult( MemberInitExpression source, MemberInitExpression target, bool areSimilar) { Assert.Equal(areSimilar, ExpressionSimilarity.AreSimilar(source, target)); }
/// <summary> /// Uses <see cref="ExpressionSimilarity"/> to determine similarity. /// </summary> /// <param name="source">The source <see cref="Expression"/>.</param> /// <param name="target">The target <see cref="Expression"/>.</param> /// <returns>A flag indicating whether the expressions are similar.</returns> public static bool IsSimilarTo( this Expression source, Expression target) => ExpressionSimilarity.AreSimilar(source, target);
/// <summary> /// Determines whether the expression tree of the query is similar to the other query. /// </summary> /// <param name="source">The source <see cref="IQueryable"/>.</param> /// <param name="target">The target <see cref="IQueryable"/>.</param> /// <returns>A flag indicating whether the queries are similar.</returns> public static bool IsSimilarTo( this IQueryable source, IQueryable target) => ExpressionSimilarity.AreSimilar( source.Expression, target?.Expression);