-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
OwnedQueryTestBase has some test data that includes empty collections of owned entity types:
var order2 = new Order
{
Id = -11,
Client = ownedPerson1,
["OrderDate"] = Convert.ToDateTime("2015-03-03 04:37:59"),
Details = []
};Interestingly, the Cosmos implementation (OwnedQueryCosmosTest) doesn't use the test data, but rather uses HasData() to seed the test data:
ob.OwnsMany(
e => e.Details, odb =>
{
odb.HasData(
new
{
Id = -100,
OrderId = -10,
OrderClientId = 1,
Detail = "Discounted Order"
},This means that the test data is duplicated and can diverge, which isn't great. But regardless, for orders which have no Details, the JSON document in the database ends up with a null collection, rather than an empty one. As a result, tests such as Where_owned_collection_navigation_ToList_Count fail, since they check for a list length of zero.
Note that this is probably not just a test problem - it may be impossible to use HasData() to seed empty collections of entity types at the moment.
/cc @AndriySvyryd (not critical)