Пример #1
0
 public DeleteQueryBuilder(
     IUniqueParameterNameGenerator uniqueParameterNameGenerator,
     DataModificationQueryBuilder queryBuilder,
     IWriteQueryExecutor queryExecutor,
     IEnumerable <IWhereClause> whereClauses = null,
     CommandParameterValues parameterValues  = null)
 {
     this.uniqueParameterNameGenerator = uniqueParameterNameGenerator;
     this.queryBuilder    = queryBuilder;
     this.queryExecutor   = queryExecutor;
     this.whereClauses    = whereClauses ?? new List <IWhereClause>();
     this.parameterValues = parameterValues ?? new CommandParameterValues();
 }
Пример #2
0
        public DeleteQueryBuilderFixture()
        {
            query      = null;
            parameters = null;

            mappings = Substitute.For <IDocumentMapRegistry>();
            mappings.Resolve <object>().Returns(c => new EmptyMap());
            mappings.Resolve(Arg.Any <Type>()).Returns(c => new EmptyMap());

            queryExecutor = Substitute.For <IWriteQueryExecutor>();
            queryExecutor.ExecuteNonQuery(Arg.Any <PreparedCommand>()).Returns(info =>
            {
                query      = info.Arg <PreparedCommand>().Statement;
                parameters = info.Arg <PreparedCommand>().ParameterValues;
                return(1);
            });
        }