private static void AssertTotalParameters <T>(QueryMode queryMode, IQueryable <T> query, Expression <Func <T, T> > expression, int parameterNumber)
        {
            var provider = query.Provider as INhQueryProvider;

            Assert.That(provider, Is.Not.Null);

            var dmlExpression = expression != null
                                ? DmlExpressionRewriter.PrepareExpression(query.Expression, expression)
                                : query.Expression;

            using (var sqlSpy = new SqlLogSpy())
            {
                Assert.That(provider.ExecuteDml <T>(queryMode, dmlExpression), Is.EqualTo(0), "The DML query updated the data");                // Avoid updating the data
                AssertParameters(sqlSpy, parameterNumber);
            }
        }
 private NhLinqExpression GetLinqExpression <T>(QueryMode queryMode, IQueryable <T> query, Expression <Func <T, T> > expression)
 {
     return(GetLinqExpression(queryMode, DmlExpressionRewriter.PrepareExpression(query.Expression, expression)));
 }