private void TestEntityParam(TestValue v) { Expression <Func <CustomersEntity, bool> > queryExp1 = ct => ct.CustomerID <= v.Id && (SQLMethod.IsNull(ct.CustomerCity)); var translate = new SqlTranslateFormater(); string sql = translate.Translate(queryExp1); Assert.Equal(sql, "CustomerID <= 50 AND CustomerCity is NULL"); }
public void SimpleWhereMethodTest3() { //IEnumerable<int> ids = new List<int>() { 40, 50 };//通过测试 //int[] ids = new[] {40, 50};//通过测试 List <int> ids = new List <int>() { 40, 50 }; //通过测试 Expression <Func <CustomersEntity, bool> > queryExp1 = ct => ids.Contains(ct.CustomerID) && (SQLMethod.IsNull(ct.CustomerCity)); var translate = new SqlTranslateFormater(); string sql = translate.Translate(queryExp1); Assert.Equal(sql, "CustomerID In (40,50) AND CustomerCity is NULL"); }
public void SimpleWhereMethodTest2() { Expression <Func <CustomersEntity, bool> > queryExp1 = ct => ct.CustomerID <= 50 && (SQLMethod.IsNull(ct.CustomerCity)); var translate = new SqlTranslateFormater(); string sql = translate.Translate(queryExp1); Assert.Equal(sql, "CustomerID <= 50 AND CustomerCity is NULL"); }