need fixing new test.
This commit is contained in:
parent
271fca885f
commit
904d3c9945
@ -110,5 +110,28 @@ namespace PoweredSoft.DynamicLinq.Test
|
|||||||
QueryableAssert.AreEqual(leftCommentLikes.AsQueryable(), rightCommentLikes.AsQueryable());
|
QueryableAssert.AreEqual(leftCommentLikes.AsQueryable(), rightCommentLikes.AsQueryable());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void SelectNullChecking2()
|
||||||
|
{
|
||||||
|
var query = TestData.Likes.AsQueryable();
|
||||||
|
|
||||||
|
var qs = query.Select(t => new
|
||||||
|
{
|
||||||
|
Post = t.Comment == null || t.Comment.Post == null ? null : t.Comment.Post,
|
||||||
|
Texts = (t.Comment == null || t.Comment.Post == null || t.Comment.Post.Comments == null ? new List<string>() : t.Comment.Post.Comments.Select(t2 => t2.CommentText)).ToList()
|
||||||
|
});
|
||||||
|
|
||||||
|
var a = qs.ToList();
|
||||||
|
|
||||||
|
var querySelect = query.Select(t =>
|
||||||
|
{
|
||||||
|
t.NullChecking(true);
|
||||||
|
// this needs to be fixed.
|
||||||
|
t.PathToList("Comment.Post.Comments.CommentText", selectCollectionHandling: SelectCollectionHandling.Flatten);
|
||||||
|
});
|
||||||
|
|
||||||
|
var b = querySelect.ToDynamicClassList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,6 +111,29 @@ namespace PoweredSoft.DynamicLinq.Test
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static readonly internal List<CommentLike> Likes = new List<CommentLike>()
|
||||||
|
{
|
||||||
|
new CommentLike
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
CommentId = 1,
|
||||||
|
Comment = new Comment
|
||||||
|
{
|
||||||
|
Email = "john@doe.ca",
|
||||||
|
CommentText = "bla bla",
|
||||||
|
Post = new Post
|
||||||
|
{
|
||||||
|
Content = "ASDFSADF"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new CommentLike
|
||||||
|
{
|
||||||
|
Id = 2,
|
||||||
|
CommentId = 2
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
static readonly internal List<Author> Authors = new List<Author>()
|
static readonly internal List<Author> Authors = new List<Author>()
|
||||||
{
|
{
|
||||||
new Author
|
new Author
|
||||||
|
Loading…
Reference in New Issue
Block a user