BuildOrderByPart() 공개 메소드

public BuildOrderByPart ( SqlStatement sqlStatement, ISqlCommandBuilder commandBuilder ) : void
sqlStatement Remotion.Linq.SqlBackend.SqlStatementModel.SqlStatement
commandBuilder ISqlCommandBuilder
리턴 void
예제 #1
0
        public void BuildOrderBy_WithSingleOrderByClause()
        {
            var columnExpression = new SqlColumnDefinitionExpression(typeof(string), "t", "Name", false);
            var orderByClause    = new Ordering(columnExpression, OrderingDirection.Asc);

            var sqlStatement = new SqlStatement(
                new TestStreamedValueInfo(typeof(int)),
                _entityExpression,
                new[] { _sqlTable },
                null,
                null,
                new[] { orderByClause },
                null,
                false,
                null,
                null);

            _stageMock.Expect(mock => mock.GenerateTextForOrdering(_commandBuilder, orderByClause))
            .WhenCalled(mi => ((SqlCommandBuilder)mi.Arguments[0]).Append("[t].[Name] ASC"));
            _stageMock.Replay();

            _generator.BuildOrderByPart(sqlStatement, _commandBuilder);

            Assert.That(_commandBuilder.GetCommandText(), Is.EqualTo(" ORDER BY [t].[Name] ASC"));
            _stageMock.VerifyAllExpectations();
        }
예제 #2
0
        public void BuildOrderBy_WithSingleOrderByClause()
        {
            var columnExpression = new SqlColumnDefinitionExpression(typeof(string), "t", "Name", false);
            var orderByClause    = new Ordering(columnExpression, OrderingDirection.Asc);

            var sqlStatement = SqlStatementModelObjectMother.CreateMinimalSqlStatement(new SqlStatementBuilder {
                Orderings = { orderByClause }
            });

            _stageMock.Expect(mock => mock.GenerateTextForOrdering(_commandBuilder, orderByClause))
            .WhenCalled(mi => ((SqlCommandBuilder)mi.Arguments[0]).Append("[t].[Name] ASC"));
            _stageMock.Replay();

            _generator.BuildOrderByPart(sqlStatement, _commandBuilder);

            Assert.That(_commandBuilder.GetCommandText(), Is.EqualTo(" ORDER BY [t].[Name] ASC"));
            _stageMock.VerifyAllExpectations();
        }