public void NullableRootThingWorks() { Expression <Func <ThingWithNullable, bool> > pred = p => !p.Nullable.HasValue || p.Nullable > 3; var outerJoinDisjunctionTransformer = new OuterJoinDisjunctionTransformer(new CustomConfig()); var result = outerJoinDisjunctionTransformer.AttemptGetOuterJoinDisjunctions(pred); Assert.False(result.ContainsOuterJoinDisjunction); }
public void RootUnaryDisjunctionReturnsSame() { Expression <Func <BoolClass, bool> > pred = p => p.IsFoo || p.BoolClassId == 1; var outerJoinDisjunctionTransformer = new OuterJoinDisjunctionTransformer(new CustomConfig()); var result = outerJoinDisjunctionTransformer.AttemptGetOuterJoinDisjunctions(pred); Assert.False(result.ContainsOuterJoinDisjunction); }
public void NoDisjunctionsReturnsSame() { Expression <Func <Post, bool> > pred = p => p.Author.UserId == 1; var outerJoinDisjunctionTransformer = new OuterJoinDisjunctionTransformer(new CustomConfig()); var result = outerJoinDisjunctionTransformer.AttemptGetOuterJoinDisjunctions(pred); Assert.False(result.ContainsOuterJoinDisjunction); }
public void RootForeignKeyJoinDisjunctionDoesnt() { Expression <Func <Post, bool> > pred = p => p.Author.UserId == 1 || p.Blog.BlogId == 2; var outerJoinDisjunctionTransformer = new OuterJoinDisjunctionTransformer(new CustomConfig()); var result = outerJoinDisjunctionTransformer.AttemptGetOuterJoinDisjunctions(pred); Assert.False(result.ContainsOuterJoinDisjunction); }
public void RootJoinDisjunctionDoesnt() { Expression <Func <Post, bool> > pred = p => p.Title == "Foo" || p.Rating == 5; var outerJoinDisjunctionTransformer = new OuterJoinDisjunctionTransformer(new CustomConfig()); var result = outerJoinDisjunctionTransformer.AttemptGetOuterJoinDisjunctions(pred); Assert.False(result.ContainsOuterJoinDisjunction); }
public void MultipleOrDisjunctionDoesnt() { Expression <Func <Post, bool> > pred = p => (p.Rating > 5 && (p.Author.Username == "Mark" || p.Blog.Title == "Bar")) || (p.Rating < 5 && (p.Author.Username == "Tom" || p.Blog.Title == "Car")); var outerJoinDisjunctionTransformer = new OuterJoinDisjunctionTransformer(new CustomConfig()); var result = outerJoinDisjunctionTransformer.AttemptGetOuterJoinDisjunctions(pred); Assert.False(result.ContainsOuterJoinDisjunction); }
public void RootForeignKeyEntityJoinDisjunctionDoesnt() { var author = new User { UserId = 1 }; var blog = new Blog { BlogId = 2 }; Expression <Func <Post, bool> > pred = p => p.Author == author || p.Blog == blog; var outerJoinDisjunctionTransformer = new OuterJoinDisjunctionTransformer(new CustomConfig()); var result = outerJoinDisjunctionTransformer.AttemptGetOuterJoinDisjunctions(pred); Assert.False(result.ContainsOuterJoinDisjunction); }
public void NonRootNullableJoinDisjunctionWorks() { Expression <Func <ReferencesThingWithNullable, bool> > pred = p => !p.Thing.Nullable.HasValue || p.Thing.Nullable > 3; var outerJoinDisjunctionTransformer = new OuterJoinDisjunctionTransformer(new CustomConfig()); var result = outerJoinDisjunctionTransformer.AttemptGetOuterJoinDisjunctions(pred); Assert.True(result.ContainsOuterJoinDisjunction); Assert.Equal(2, result.UnionWhereClauses.Count()); Assert.Equal( ((Expression <Func <ReferencesThingWithNullable, bool> >)(p => !p.Thing.Nullable.HasValue)).ToDebugString(), result.UnionWhereClauses.ElementAt(0) .ToDebugString()); Assert.Equal( ((Expression <Func <ReferencesThingWithNullable, bool> >)(p => p.Thing.Nullable > 3)).ToDebugString(), result.UnionWhereClauses.ElementAt(1) .ToDebugString()); }
public void NonRootJoinDisjunctionWorks() { Expression <Func <Post, bool> > pred = p => p.Author.Username == "Mark" || p.Blog.Title == "Foo"; var outerJoinDisjunctionTransformer = new OuterJoinDisjunctionTransformer(new CustomConfig()); var result = outerJoinDisjunctionTransformer.AttemptGetOuterJoinDisjunctions(pred); Assert.True(result.ContainsOuterJoinDisjunction); Assert.Equal(2, result.UnionWhereClauses.Count()); Assert.Equal( ((Expression <Func <Post, bool> >)(p => p.Author.Username == "Mark")).ToDebugString(), result.UnionWhereClauses.ElementAt(0) .ToDebugString()); Assert.Equal( ((Expression <Func <Post, bool> >)(p => p.Blog.Title == "Foo")).ToDebugString(), result.UnionWhereClauses.ElementAt(1) .ToDebugString()); }
public void NonRootBoolMemberAccessJoinDisjunctionWorks() { var user = new User { UserId = 1 }; Expression <Func <Comment, bool> > pred = p => p.Post.DoNotMap || p.User == user; var outerJoinDisjunctionTransformer = new OuterJoinDisjunctionTransformer(new CustomConfig()); var result = outerJoinDisjunctionTransformer.AttemptGetOuterJoinDisjunctions(pred); Assert.True(result.ContainsOuterJoinDisjunction); Assert.Equal(2, result.UnionWhereClauses.Count()); Assert.Equal( ((Expression <Func <Comment, bool> >)(p => p.Post.DoNotMap)).ToDebugString(), result.UnionWhereClauses.ElementAt(0) .ToDebugString()); Assert.Equal( ((Expression <Func <Comment, bool> >)(p => p.User == user)).ToDebugString(), result.UnionWhereClauses.ElementAt(1) .ToDebugString()); }