public WhereQueryable( SqlQueryable <TProjected, TMapped> target, Expression <Func <TProjected, bool> > predicate) { this.target = target; this.predicate = predicate; }
public SelectQueryable( SqlQueryable <TProjectedIn, TMapped> target, Expression <Func <TProjectedIn, TProjectedOut> > mapper) { this.target = target; this.mapper = mapper; }
public ItemExecutable( SqlQueryable <TProjected, TMapped> queryable, Expression <Func <TProjected, bool> > predicate) : base(queryable, predicate) { this.queryable = queryable; this.predicate = predicate; }
public void SqlQueryableHelper_Count_ArgumentExceptions() { // Prepare the test data SqlQueryable source = new SqlQueryable(connection, "Table", new[] { "Field" }); // Perform the test operation Assert.ThrowsException <ArgumentNullException>(() => SqlQueryableHelper.Count(null, x => true)); }
public void SqlQueryableHelper_SingleOrDefault_ArgumentExceptions() { // Prepare the test data SqlQueryable source = new SqlQueryable(connection, "Table", new[] { "Field" }); // Perform the test operation SqlQueryableHelper.SingleOrDefault(null, x => true); }
public void SqlQueryableHelper_Min_ArgumentExceptions() { // Prepare the test data SqlQueryable source = new SqlQueryable(connection, "Table", new[] { "Field" }); // Perform the test operation Assert.ThrowsException <ArgumentNullException>(() => SqlQueryableHelper.Min(null, x => 42)); Assert.ThrowsException <ArgumentNullException>(() => SqlQueryableHelper.Min <int>(source, null)); }
public void SqlQueryableHelper_LastOrDefault_ArgumentExceptions() { // Prepare the test data SqlQueryable source = new SqlQueryable(connection, "Table", new[] { "Field" }); // Perform the test operation // Perform the test operation Assert.ThrowsException <ArgumentNullException>(() => SqlQueryableHelper.LastOrDefault(null, y => 1, null)); Assert.ThrowsException <ArgumentNullException>(() => SqlQueryableHelper.LastOrDefault(source, null, null)); }
public void SqlQueryableHelper_Contains_ArgumentExceptions() { // Prepare the test data SqlQueryable source = new SqlQueryable(connection, "Table", new[] { "Field" }); Expression <Func <Record, object> > selector = record => record["key"]; // Perform the test operations Assert.ThrowsException <ArgumentNullException>(() => SqlQueryableHelper.Contains(null, selector, 42)); Assert.ThrowsException <ArgumentNullException>(() => SqlQueryableHelper.Contains(source, null, 42)); }
public OrderByQueryable( SqlQueryable <TProjected, TMapped> target, Expression <Func <TProjected, TOrderByMember> > orderer, bool isDescending, bool isThenBy) { this.target = target; this.orderer = orderer; this.isDescending = isDescending; this.isThenBy = isThenBy; }
public void SqlTranslatorVisitor_DecodeJoinSelector_DuplicatedSelection() { // Prepare the test data SqlQueryable outer = new SqlQueryable(connection, "Table", new string[] { "Field" }); SqlQueryable inner = new SqlQueryable(connection, "Table", new string[] { "Field" }); Expression <Action> expression = () => outer .Join(inner, (o, i) => true, (o, i) => i | i, JoinType.Inner); // Perform the test operation visitor.Visit(expression.Body); }
public void QueryHelper_SelectRecordItems_Table_KeyNotFoundException() { // Prepare the test data DbConnection connection = ConnectionTestHelper.CreatePopulatedConnection(); SqlQueryable query = new SqlQueryable(connection, "Course", new string[] { "Id", "Name" }); // Perform the test operation query .SelectRecordItems("NotATable") .ToArray(); }
public void SqlQueryableHelper_Join() { // Prepare the test data SqlQueryable outer = new SqlQueryable(connection, "OuterTable", new[] { "OuterField" }); SqlQueryable inner = new SqlQueryable(connection, "InnerTable", new[] { "InnerField" }); // Perform the test operations IQueryable <Record> query = SqlQueryableHelper.Join(outer, inner, (o, i) => true, (o, i) => i); // Check the test result Assert.AreSame(outer.Provider, query.Provider); }
public void SqlQueryableHelper_Join_ArgumentExceptions() { // Prepare the test data SqlQueryable outer = new SqlQueryable(connection, "OuterTable", new[] { "OuterField" }); SqlQueryable inner = new SqlQueryable(connection, "InnerTable", new[] { "InnerField" }); // Perform the test operations Assert.ThrowsException <ArgumentNullException>(() => SqlQueryableHelper.Join(null, inner, (o, i) => true, (o, i) => i, JoinType.Inner)); Assert.ThrowsException <ArgumentNullException>(() => SqlQueryableHelper.Join(outer, null, (o, i) => true, (o, i) => i, JoinType.Inner)); Assert.ThrowsException <ArgumentNullException>(() => SqlQueryableHelper.Join(outer, inner, null, (o, i) => i, JoinType.Inner)); Assert.ThrowsException <ArgumentNullException>(() => SqlQueryableHelper.Join(outer, inner, (o, i) => true, null, JoinType.Inner)); }
public void SqlQueryableHelper_Average_ArgumentExceptions() { // Prepare the test data SqlQueryable source = new SqlQueryable(connection, "Table", new[] { "Field" }); // Perform the test operations Assert.ThrowsException <ArgumentNullException>(() => SqlQueryableHelper.Average(null, x => (int)x["Field"]["Value"])); Assert.ThrowsException <ArgumentNullException>(() => SqlQueryableHelper.Average(source, null)); Assert.ThrowsException <ArgumentNullException>(() => SqlQueryableHelper.Average(source, (Expression <Func <Record, long> >)null)); Assert.ThrowsException <ArgumentNullException>(() => SqlQueryableHelper.Average(source, (Expression <Func <Record, decimal> >)null)); Assert.ThrowsException <ArgumentNullException>(() => SqlQueryableHelper.Average(source, (Expression <Func <Record, float> >)null)); Assert.ThrowsException <ArgumentNullException>(() => SqlQueryableHelper.Average(source, (Expression <Func <Record, double> >)null)); }
public void QueryHelper_SelectRecordItems_Table() { // Prepare the test data DbConnection connection = ConnectionTestHelper.CreatePopulatedConnection(); SqlQueryable query = new SqlQueryable(connection, "Course", new string[] { "Id", "Name" }); // Perform the test operation RecordItem[] items = query .SelectRecordItems("Course") .ToArray(); // Check the test result Assert.AreEqual(ConnectionTestHelper.CountCourses, items.Length); foreach (RecordItem item in items) { Assert.IsTrue(item.ContainsKey("Id")); Assert.IsTrue(item.ContainsKey("Name")); Assert.IsTrue(typeof(long).IsAssignableFrom(item["Id"].GetType())); Assert.IsInstanceOfType(item["Name"], typeof(string)); } }
public CountExecutable( SqlQueryable <TProjected, TMapped> queryable, Expression <Func <TProjected, bool> > predicate) : base(queryable, predicate) { }
public IQueryable CreateQuery(Expression expression) { var query = new SqlQueryable <object>(this, expression); return(query); }
//private static readonly MethodInfo _genericCreateQueryMethod // = typeof(SqlQueryProvider).GetRuntimeMethods() // .Single(m => (m.Name == "CreateQuery") && m.IsGenericMethod); //private readonly MethodInfo _genericExecuteMethod; //private readonly IQueryCompiler _queryCompiler; //public SqlQueryProvider([NotNull] IQueryCompiler queryCompiler) //{ //} public IQueryable <TElement> CreateQuery <TElement>(Expression expression) { var query = new SqlQueryable <TElement>(this, expression); return(query); }
public SqlQueryable_Delete_Tests() { _Queryable = QueryableFactory<SysUser>.SQLServerQueryable(); _Queryable.Clear(); }
public Dapper_Select_Tests() { _Repository = new DapperRepository <SysUser>(); _Queryable = QueryableFactory <SysUser> .SQLServerQueryable(); }
public SqlQueryable_Select_Tests() { sqlQuery = QueryableFactory <SysUser> .SQLServerQueryable(); sqlQuery.Clear(); }