Example #1
0
        public void VisitExpression_AnyOtherExpression()
        {
            var visitor = new GroupAggregateSimplifier.SimplifyingVisitor(_resolvedJoinedGroupingTable, _associatedGroupingSelectExpression.ElementExpression);

            var input  = Expression.Constant(0);
            var result = visitor.VisitExpression(input);

            Assert.That(visitor.CanBeTransferredToGroupingSource, Is.True);
            Assert.That(result, Is.SameAs(input));
        }
Example #2
0
        public void VisitExpression_ReferenceToOtherTable()
        {
            var visitor = new GroupAggregateSimplifier.SimplifyingVisitor(_resolvedJoinedGroupingTable, _associatedGroupingSelectExpression.ElementExpression);

            var input = new SqlTableReferenceExpression(SqlStatementModelObjectMother.CreateSqlTable());

            visitor.VisitExpression(input);

            Assert.That(visitor.CanBeTransferredToGroupingSource, Is.False);
        }
Example #3
0
        public void VisitExpression_ReferenceToRightTable()
        {
            var visitor = new GroupAggregateSimplifier.SimplifyingVisitor(_resolvedJoinedGroupingTable, _associatedGroupingSelectExpression.ElementExpression);

            var input  = new SqlTableReferenceExpression(_resolvedJoinedGroupingTable);
            var result = visitor.VisitExpression(input);

            Assert.That(visitor.CanBeTransferredToGroupingSource, Is.True);
            Assert.That(result, Is.SameAs(_associatedGroupingSelectExpression.ElementExpression));
        }
Example #4
0
        public void VisitExpression_ReferenceToRightTable_Nested()
        {
            var visitor = new GroupAggregateSimplifier.SimplifyingVisitor(_resolvedJoinedGroupingTable, _associatedGroupingSelectExpression.ElementExpression);

            var input = Expression.Equal(
                new SqlTableReferenceExpression(_resolvedJoinedGroupingTable),
                new SqlTableReferenceExpression(_resolvedJoinedGroupingTable));

            var result = visitor.VisitExpression(input);

            Assert.That(visitor.CanBeTransferredToGroupingSource, Is.True);
            var expectedResult = Expression.Equal(
                _associatedGroupingSelectExpression.ElementExpression,
                _associatedGroupingSelectExpression.ElementExpression);

            SqlExpressionTreeComparer.CheckAreEqualTrees(expectedResult, result);
        }