示例#1
0
        private static void AssertTransformation <TResult>(
            Expression <Func <IQueryable <MyClass1>, TResult> > input,
            Expression <Func <IQueryable <MyClass1>, TResult> > output)
        {
            var visitor = new SelectorPushdownExpressionVisitor();

            var result = visitor.Visit(input.Body);

            var inputHash = ExpressionEqualityComparer.Instance.GetHashCode(result);

            var outputHash = ExpressionEqualityComparer.Instance.GetHashCode(output.Body);

            Assert.AreEqual(inputHash, outputHash, "Output expression trees do not match");
        }
示例#2
0
        private static void AssertTransformation <TResult>(
            Expression <Func <IQueryable <MyClass1>, TResult> > input,
            Expression <Func <IQueryable <MyClass1>, TResult> > output)
        {
            var visitor = new SelectorPushdownExpressionVisitor();

            var result = visitor.Visit(input.Body);

            var hasher = new HashingExpressionVisitor();

            hasher.Visit(result);

            var inputHash = hasher.HashCode;

            hasher.Reset();

            hasher.Visit(output.Body);

            var outputHash = hasher.HashCode;

            Assert.AreEqual(inputHash, outputHash, "Output expression trees do not match");
        }