public void TestDelete() { Delete del = Qb.Delete("Customers") .Where(Cond.Equal("Id", 20)); Renderer.SqlServerRenderer renderer = new Renderer.SqlServerRenderer(); string sql = renderer.RenderDelete(del); del = Qb.Delete("Customers", "nsi") .Where(Cond.Equal("Id", 20)); sql = renderer.RenderDelete(del); }
public void ExecuteAsyncTest() { using (AnyDbConnection con = _factory.OpenConnection()) { Insert ins = Qb.Insert("customer") .Values( Value.New("first_name", "123"), Value.New("last_name", "456") ); con.ExecuteAsync(ins).Wait(); Assert.Equal(101, GetAll(con).Count()); ins = Qb.Insert("customer") .Values( Value.New("first_name", "321"), Value.New("last_name", "654") ); con.ExecuteAsync(ins).Wait(); Assert.Equal(102, GetAll(con).Count()); Select sel_0 = Qb.Select("*").From("customer").Page(0, 200); sel_0 = sel_0.OrderBy("first_name"); var page = con.QueryAsync(sel_0).Result; Assert.Equal(102, page.Count()); Update upd = Qb.Update("customer") .Values( Value.New("first_name", "XXX") ); int res = con.ExecuteAsync(upd).Result; Assert.Equal(102, res); Select sel = Qb.Select("*") .From("customer"); IEnumerable <Customer> en = con.QueryAsync <Customer>(sel).Result; Assert.Equal(102, en.Count()); Delete del = Qb.Delete("customer"); res = con.ExecuteAsync(del).Result; Assert.Equal(102, res); } }