need fixing new test.

This commit is contained in:
David Lebée 2018-04-13 18:20:12 -05:00
parent 271fca885f
commit 904d3c9945
2 changed files with 46 additions and 0 deletions

View File

@ -110,5 +110,28 @@ namespace PoweredSoft.DynamicLinq.Test
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();
}
}
}

View File

@ -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>()
{
new Author