public void BasicTest() { Expression<Func<GracefulTestModel, bool>> expression = e => e.Foo == "Hello"; var converter = new AssignmentsConverter(); converter.Visit(expression.Body); Assert.Equal("[Foo] = {0}", converter.Sql); Assert.Equal(new object[] {"Hello"}, converter.Parameters); }
public void MethodVarTest(int value) { Expression<Func<GracefulTestModel, bool>> expression = e => e.Bar == value; var converter = new AssignmentsConverter(); converter.Visit(expression.Body); Assert.Equal("[Bar] = {0}", converter.Sql); Assert.Equal(new object[] {123}, converter.Parameters); }
public void AndTest() { Expression<Func<GracefulTestModel, bool>> expression = e => e.Foo == "Hello" && e.Bar == 123; var converter = new AssignmentsConverter(); converter.Visit(expression.Body); Assert.Equal("[Foo] = {0}, [Bar] = {1}", converter.Sql); Assert.Equal(new object[] {"Hello", 123}, converter.Parameters); }
private void MethodVarObjectTestPrvate(Models.CustomContext entity) { Expression<Func<Models.CustomContext, bool>> expression = e => e.Foo == entity.Foo; var converter = new AssignmentsConverter(); converter.Visit(expression.Body); Assert.Equal("[Foo] = {0}", converter.Sql); Assert.Equal(new object[] { "Bar" }, converter.Parameters); }