Пример #1
0
 public static void Add(this IClauseCollection clauseCollection, Clause clause)
 {
     if (clauseCollection.Count > 0)
     {
         clauseCollection.Add(Clause.SqlAnd, clause);
     }
     else
     {
         clauseCollection.Add(null, clause);
     }
 }
Пример #2
0
        private static IClauseCollection Add(this IClauseCollection clauseCollection, string @operator, string sql)
        {
            Clause clause = new Clause(sql, clauseCollection.Parameters);

            clauseCollection.Add(@operator, clause);
            return(clauseCollection);
        }
        public void Or_calls_Add_with_arguments()
        {
            IClauseCollection clauseCollection = A.Fake <IClauseCollection>();

            IClauseCollectionExtensions.Or(clauseCollection, "1=1");

            // assert the 2nd argument of Add() was called with the clause argument where the sql matches and with the correct operator
            A.CallTo(() => clauseCollection.Add("And", A <Clause> .Ignored))
            .WhenArgumentsMatch(x =>
            {
                return
                (x.Get <string>(0) == "Or" &&
                 x.Get <Clause>(1).Sql() == "1=1");
            }).MustHaveHappened();
        }
Пример #4
0
        public static void Add(this IClauseCollection clauseCollection, string @operator, string column, SqlOperator sqlOperator, object value)
        {
            Clause clause = new Clause(clauseCollection.Parameters, column, sqlOperator, value);

            clauseCollection.Add(@operator, clause);
        }