Esempio n. 1
0
        public void GenerateWhereConditionWithSpecificParameterName()
        {
            DefaultQuerySqlGenerator generator = CreateQuerySqlGenerator();

            Expression <Func <Person, bool> > where = (p) => p.Id == 1 && p.FirstName.StartsWith("M");

            WhereExpression whereExpression = generator.GenerateWhereCondition(where, "Filter");

            whereExpression.Sql.Should().Be("((Id = @Filter1) AND (Name LIKE @Filter2 + '%'))");
        }
Esempio n. 2
0
        public void GenerateWhereCondition()
        {
            DefaultQuerySqlGenerator generator = CreateQuerySqlGenerator();

            Expression <Func <Person, bool> > where = (p) => p.Id == 1 && p.FirstName.StartsWith("M");

            WhereExpression whereExpression = generator.GenerateWhereCondition(where);

            whereExpression.Sql.Should().Be("((Id = @1) AND (Name LIKE @2 + '%'))");
            whereExpression.Parameters.Should().BeEquivalentTo(new object[] { 1, "M" });
        }