//[Theory] //[MemberData(nameof(NonEquivalentExpressions))] public void GetExpressionText_CheckNonEquivalentExpressions_Theory(LambdaExpression expression1, LambdaExpression expression2) { // Act - 1 var text1 = ExpressionHelper.GetExpressionText(expression1, _expressionTextCache); // Act - 2 var text2 = ExpressionHelper.GetExpressionText(expression2, _expressionTextCache); // Assert Assert2.NotEqual(text1, text2, StringComparer.Ordinal); Assert2.NotSame(text1, text2); }
public void HashCode_Is_OrderSensitive() { var hashCode1 = HashCodeCombiner.Start(); var hashCode2 = HashCodeCombiner.Start(); hashCode1.Add(42); hashCode1.Add("foo"); hashCode2.Add("foo"); hashCode2.Add(42); Assert2.NotEqual(hashCode1.CombinedHash, hashCode2.CombinedHash); }
private void VerifyNotEquals(MemberExpressionCacheKey key1, MemberExpressionCacheKey key2) { var hashCode1 = Comparer.GetHashCode(key1); var hashCode2 = Comparer.GetHashCode(key2); Assert2.NotEqual(hashCode1, hashCode2); Assert2.NotEqual(key1, key2, Comparer); var cachedKey1 = key1.MakeCacheable(); Assert2.NotEqual(key2, cachedKey1, Comparer); var cachedKeyHashCode1 = Comparer.GetHashCode(cachedKey1); Assert2.NotEqual(cachedKeyHashCode1, hashCode2); }