public void SimpleMethodTest() { Expression <Func <List, bool> > initial = l => l.Title.Contains("Test"); Expression <Func <List, bool> > expected = l => l.Title.Contains("Test") == true; var actual = (Expression <Func <List, bool> >) new ExpressionNormalizer(initial).Normalize(); Assert.IsTrue(LambdaCompare.Eq(actual, expected)); }
public void SimpleNotBoolTest() { Expression <Func <List, bool> > initial = l => !l.Hidden; Expression <Func <List, bool> > expected = l => l.Hidden == false; var actual = (Expression <Func <List, bool> >) new ExpressionNormalizer(initial).Normalize(); Assert.IsTrue(LambdaCompare.Eq(actual, expected)); }
public void ComplexBoolNotReversTest() { Expression <Func <List, bool> > initial = l => l.Title == "Test" && !l.Hidden; Expression <Func <List, bool> > expected = l => l.Title == "Test" && l.Hidden == false; var actual = (Expression <Func <List, bool> >) new ExpressionNormalizer(initial).Normalize(); Assert.IsTrue(LambdaCompare.Eq(actual, expected)); }
public void ComplexMethodChainTest() { Expression <Func <List, bool> > initial = l => l.Title.Contains("Test") && l.Title == "Test" && !l.Hidden && l.Title.StartsWith("Value"); Expression <Func <List, bool> > expected = l => l.Title.Contains("Test") == true && l.Title == "Test" && l.Hidden == false && l.Title.StartsWith("Value") == true; var actual = (Expression <Func <List, bool> >) new ExpressionNormalizer(initial).Normalize(); Assert.IsTrue(LambdaCompare.Eq(actual, expected)); }