BuildTopPart() public method

public BuildTopPart ( SqlStatement sqlStatement, ISqlCommandBuilder commandBuilder ) : void
sqlStatement Remotion.Linq.SqlBackend.SqlStatementModel.SqlStatement
commandBuilder ISqlCommandBuilder
return void
Exemplo n.º 1
0
        public void BuildTopPart()
        {
            var topExpression = Expression.Constant("top");
            var sqlStatement  = SqlStatementModelObjectMother.CreateMinimalSqlStatement(new SqlStatementBuilder {
                TopExpression = topExpression
            });

            _stageMock.Expect(mock => mock.GenerateTextForTopExpression(_commandBuilder, topExpression))
            .WhenCalled(mi => ((SqlCommandBuilder)mi.Arguments[0]).Append("top"));
            _stageMock.Replay();

            _generator.BuildTopPart(sqlStatement, _commandBuilder);

            Assert.That(_commandBuilder.GetCommandText(), Is.EqualTo("TOP (top) "));
            _stageMock.VerifyAllExpectations();
        }
Exemplo n.º 2
0
        public void BuildTopPart()
        {
            var topExpression = Expression.Constant("top");
            var sqlStatement  = new SqlStatement(
                new TestStreamedValueInfo(typeof(int)),
                _entityExpression,
                new[] { _sqlTable },
                null,
                null,
                new Ordering[] { },
                topExpression,
                false,
                null,
                null);

            _stageMock.Expect(mock => mock.GenerateTextForTopExpression(_commandBuilder, topExpression))
            .WhenCalled(mi => ((SqlCommandBuilder)mi.Arguments[0]).Append("top"));
            _stageMock.Replay();

            _generator.BuildTopPart(sqlStatement, _commandBuilder);

            Assert.That(_commandBuilder.GetCommandText(), Is.EqualTo("TOP (top) "));
            _stageMock.VerifyAllExpectations();
        }