public void SetupExecuteScalarAsync <T>(Expression <Func <string, bool> > sqlMatcher, Dictionary <string, object> param, T result, Dictionary <string, object> outParameters = null) { Expression <Func <object, bool> > match = p => param == null || param.All(kv => Matches(kv.Value, SqlConnectionWrapper.Get <object>(p, kv.Key))); Setup(c => c.ExecuteScalarAsync <T>(It.Is(sqlMatcher), It.Is(match), It.IsAny <IDbTransaction>(), It.IsAny <int?>(), It.IsAny <CommandType?>()), result, outParameters); }
public void SetupQueryMultipleAsync <T1, T2, T3, T4>(string sql, Dictionary <string, object> param, Tuple <IEnumerable <T1>, IEnumerable <T2>, IEnumerable <T3>, IEnumerable <T4> > result, Dictionary <string, object> outParameters = null) { Expression <Func <object, bool> > match = p => param == null || param.All(kv => Matches(kv.Value, SqlConnectionWrapper.Get <object>(p, kv.Key))); Setup(c => c.QueryMultipleAsync <T1, T2, T3, T4>(sql, It.Is(match), It.IsAny <IDbTransaction>(), It.IsAny <int?>(), CommandType.StoredProcedure), result, outParameters); }
public void SetupExecuteAsync(string sql, Dictionary <string, object> param, int result, Dictionary <string, object> outParameters = null) { Expression <Func <object, bool> > match = p => param == null || param.All(kv => Matches(kv.Value, SqlConnectionWrapper.Get <object>(p, kv.Key))); Setup(c => c.ExecuteAsync(sql, It.Is(match), It.IsAny <IDbTransaction>(), It.IsAny <int?>(), CommandType.StoredProcedure), result, outParameters); }