BuildWherePart() публичный Метод

public BuildWherePart ( SqlStatement sqlStatement, ISqlCommandBuilder commandBuilder ) : void
sqlStatement Remotion.Linq.SqlBackend.SqlStatementModel.SqlStatement
commandBuilder ISqlCommandBuilder
Результат void
Пример #1
0
        public void BuildWhere_WithSingleWhereCondition()
        {
            var sqlStatement = SqlStatementModelObjectMother.CreateMinimalSqlStatement(new SqlStatementBuilder {
                WhereCondition = Expression.Constant(true)
            });

            _stageMock.Expect(mock => mock.GenerateTextForWhereExpression(_commandBuilder, sqlStatement.WhereCondition))
            .WhenCalled(mi => ((SqlCommandBuilder)mi.Arguments[0]).Append("(@1 = 1)"));
            _stageMock.Replay();

            _generator.BuildWherePart(sqlStatement, _commandBuilder);

            Assert.That(_commandBuilder.GetCommandText(), Is.EqualTo(" WHERE (@1 = 1)"));
            _stageMock.VerifyAllExpectations();
        }
Пример #2
0
        public void BuildWhere_WithSingleWhereCondition()
        {
            var sqlStatement =
                new SqlStatementBuilder
            {
                DataInfo         = new TestStreamedValueInfo(typeof(int)),
                SelectProjection = _entityExpression,
                WhereCondition   = Expression.Constant(true)
            }
            .GetSqlStatement();

            _stageMock.Expect(mock => mock.GenerateTextForWhereExpression(_commandBuilder, sqlStatement.WhereCondition))
            .WhenCalled(mi => ((SqlCommandBuilder)mi.Arguments[0]).Append("(@1 = 1)"));
            _stageMock.Replay();

            _generator.BuildWherePart(sqlStatement, _commandBuilder);

            Assert.That(_commandBuilder.GetCommandText(), Is.EqualTo(" WHERE (@1 = 1)"));
            _stageMock.VerifyAllExpectations();
        }