public void VisitBinaryExpression_ExclusiveOr_OnBooleans()
        {
            var binaryExpression      = Expression.ExclusiveOr(_trueExpression, _falseExpression);
            var expectedXorSimulation = Expression.OrElse(
                Expression.AndAlso(_trueExpression, Expression.Not(_falseExpression)),
                Expression.AndAlso(Expression.Not(_trueExpression), _falseExpression));

            _expressionVisitorMock
            .Expect(mock => mock.VisitExpression(Arg <Expression> .Matches(expr => expr is BinaryExpression)))
            .WhenCalled(mi =>
            {
                var expr = (BinaryExpression)mi.Arguments[0];
                SqlExpressionTreeComparer.CheckAreEqualTrees(expr, expectedXorSimulation);
                _commandBuilder.Append("XOR SIMULATION");
            })
            .Return(null);

            _generator.GenerateSqlForBinaryExpression(binaryExpression);

            _expressionVisitorMock.VerifyAllExpectations();

            var result = _commandBuilder.GetCommandText();

            Assert.That(result, Is.EqualTo("XOR SIMULATION"));
        }
        public void SetUp()
        {
            mocks = new MockRepository();

            visitor1 = mocks.StrictMock <ExpressionTreeVisitor>();
            visitor2 = mocks.StrictMock <ExpressionTreeVisitor>();
            var visitors = new[] { visitor1, visitor2 };

            transformer = new QueryModelTransformer(visitors, visitors);

            using (mocks.Ordered())
            {
                visitor1.Expect(v => v.VisitExpression(whereClause.Predicate)).Return(whereClause.Predicate);
                visitor2.Expect(v => v.VisitExpression(whereClause.Predicate)).Return(whereClause.Predicate);
            }

            mocks.ReplayAll();
        }