Skip to content

Commit fac79bf

Browse files
committed
Motivation:
We want to be able to re-use existing navigation tests (currently spread around multiple test classes - complex navs, gears of war, northwind, json) for the upcoming optional complex types, complex collections and json-mapped complex types (all highly requested features in EF). We also want to be able to increase coverage for existing features, e.g. we have very good coverage of navigations in json test suite, but it's not used for regular or owned entities. This work can also be used by provider writers (e.g. Mongo) to boost their coverage. Navigation test refactoring: - using common model for entity, owned, json and complex type navigations - 4 levels: root, trunk, branch, leaf - optional reference, required reference (dependent to principal), collection - for now just testing projection scenarios as proof of concept (tracking / notracking) TODO: - fix owned sqlite model, - add model with inheritance, - move actual tests from existing test suites (ongoing), - add migration check (that model can be migrated to from scratch and that noop is actual noop), - implement InMemory tests. - added include stub - added cosmos tests
1 parent 30eb1fb commit fac79bf

File tree

73 files changed

+6691
-1045
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+6691
-1045
lines changed

Diff for: test/EFCore.Cosmos.FunctionalTests/Query/JsonQueryCosmosTest.cs

-229
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,6 @@ FROM root c
3434
""");
3535
});
3636

37-
public override async Task Basic_json_projection_owned_collection_branch(bool async)
38-
{
39-
// Always throws for sync.
40-
if (async)
41-
{
42-
//issue #31696
43-
await Assert.ThrowsAsync<NullReferenceException>(
44-
() => base.Basic_json_projection_owned_collection_branch(async));
45-
}
46-
}
47-
4837
public override async Task Basic_json_projection_owned_collection_branch_NoTrackingWithIdentityResolution(bool async)
4938
{
5039
// Always throws for sync.
@@ -67,21 +56,6 @@ await Assert.ThrowsAsync<NullReferenceException>(
6756
}
6857
}
6958

70-
public override Task Basic_json_projection_owned_collection_root(bool async)
71-
=> Fixture.NoSyncTest(
72-
async, async a =>
73-
{
74-
await base.Basic_json_projection_owned_collection_root(a);
75-
76-
// TODO: issue #34067 (?)
77-
AssertSql(
78-
"""
79-
SELECT VALUE c
80-
FROM root c
81-
WHERE (c["Discriminator"] = "Basic")
82-
""");
83-
});
84-
8559
public override Task Basic_json_projection_owned_collection_root_NoTrackingWithIdentityResolution(bool async)
8660
=> Fixture.NoSyncTest(
8761
async, async a =>
@@ -94,20 +68,6 @@ public override Task Basic_json_projection_owned_collection_root_NoTrackingWithI
9468
SELECT VALUE c
9569
FROM root c
9670
WHERE (c["Discriminator"] = "Basic")
97-
""");
98-
});
99-
100-
public override Task Basic_json_projection_owned_reference_branch(bool async)
101-
=> Fixture.NoSyncTest(
102-
async, async a =>
103-
{
104-
await base.Basic_json_projection_owned_reference_branch(async);
105-
106-
AssertSql(
107-
"""
108-
SELECT VALUE c
109-
FROM root c
110-
WHERE (c["Discriminator"] = "Basic")
11171
""");
11272
});
11373

@@ -122,36 +82,6 @@ public override Task Basic_json_projection_owned_reference_branch_NoTrackingWith
12282
SELECT VALUE c
12383
FROM root c
12484
WHERE (c["Discriminator"] = "Basic")
125-
""");
126-
});
127-
128-
public override Task Basic_json_projection_owned_reference_duplicated(bool async)
129-
=> Fixture.NoSyncTest(
130-
async, async a =>
131-
{
132-
await base.Basic_json_projection_owned_reference_duplicated(async);
133-
134-
AssertSql(
135-
"""
136-
SELECT VALUE c
137-
FROM root c
138-
WHERE (c["Discriminator"] = "Basic")
139-
ORDER BY c["Id"]
140-
""");
141-
});
142-
143-
public override Task Basic_json_projection_owned_reference_duplicated2(bool async)
144-
=> Fixture.NoSyncTest(
145-
async, async a =>
146-
{
147-
await base.Basic_json_projection_owned_reference_duplicated2(async);
148-
149-
AssertSql(
150-
"""
151-
SELECT VALUE c
152-
FROM root c
153-
WHERE (c["Discriminator"] = "Basic")
154-
ORDER BY c["Id"]
15585
""");
15686
});
15787

@@ -196,21 +126,6 @@ public override Task Basic_json_projection_owned_reference_leaf(bool async)
196126
SELECT VALUE c
197127
FROM root c
198128
WHERE (c["Discriminator"] = "Basic")
199-
""");
200-
});
201-
202-
public override Task Basic_json_projection_owned_reference_root(bool async)
203-
=> Fixture.NoSyncTest(
204-
async, async a =>
205-
{
206-
await base.Basic_json_projection_owned_reference_root(a);
207-
208-
// TODO: issue #34067 (?)
209-
AssertSql(
210-
"""
211-
SELECT VALUE c
212-
FROM root c
213-
WHERE (c["Discriminator"] = "Basic")
214129
""");
215130
});
216131

@@ -226,48 +141,6 @@ public override Task Basic_json_projection_owned_reference_root_NoTrackingWithId
226141
SELECT VALUE c
227142
FROM root c
228143
WHERE (c["Discriminator"] = "Basic")
229-
""");
230-
});
231-
232-
public override Task Basic_json_projection_owner_entity(bool async)
233-
=> Fixture.NoSyncTest(
234-
async, async a =>
235-
{
236-
await base.Basic_json_projection_owner_entity(a);
237-
238-
AssertSql(
239-
"""
240-
SELECT VALUE c
241-
FROM root c
242-
WHERE (c["Discriminator"] = "Basic")
243-
""");
244-
});
245-
246-
public override Task Basic_json_projection_owner_entity_duplicated(bool async)
247-
=> Fixture.NoSyncTest(
248-
async, async a =>
249-
{
250-
await base.Basic_json_projection_owner_entity_duplicated(a);
251-
252-
AssertSql(
253-
"""
254-
SELECT VALUE c
255-
FROM root c
256-
WHERE (c["Discriminator"] = "Basic")
257-
""");
258-
});
259-
260-
public override Task Basic_json_projection_owner_entity_duplicated_NoTracking(bool async)
261-
=> Fixture.NoSyncTest(
262-
async, async a =>
263-
{
264-
await base.Basic_json_projection_owner_entity_duplicated_NoTracking(a);
265-
266-
AssertSql(
267-
"""
268-
SELECT VALUE c
269-
FROM root c
270-
WHERE (c["Discriminator"] = "SingleOwned")
271144
""");
272145
});
273146

@@ -282,20 +155,6 @@ public override Task Basic_json_projection_owner_entity_duplicated_NoTrackingWit
282155
SELECT VALUE c
283156
FROM root c
284157
WHERE (c["Discriminator"] = "SingleOwned")
285-
""");
286-
});
287-
288-
public override Task Basic_json_projection_owner_entity_NoTracking(bool async)
289-
=> Fixture.NoSyncTest(
290-
async, async a =>
291-
{
292-
await base.Basic_json_projection_owner_entity_NoTracking(a);
293-
294-
AssertSql(
295-
"""
296-
SELECT VALUE c
297-
FROM root c
298-
WHERE (c["Discriminator"] = "Basic")
299158
""");
300159
});
301160

@@ -310,34 +169,6 @@ public override Task Basic_json_projection_owner_entity_NoTrackingWithIdentityRe
310169
SELECT VALUE c
311170
FROM root c
312171
WHERE (c["Discriminator"] = "Basic")
313-
""");
314-
});
315-
316-
public override Task Basic_json_projection_owner_entity_twice(bool async)
317-
=> Fixture.NoSyncTest(
318-
async, async a =>
319-
{
320-
await base.Basic_json_projection_owner_entity_twice(a);
321-
322-
AssertSql(
323-
"""
324-
SELECT VALUE c
325-
FROM root c
326-
WHERE (c["Discriminator"] = "Basic")
327-
""");
328-
});
329-
330-
public override Task Basic_json_projection_owner_entity_twice_NoTracking(bool async)
331-
=> Fixture.NoSyncTest(
332-
async, async a =>
333-
{
334-
await base.Basic_json_projection_owner_entity_twice_NoTracking(a);
335-
336-
AssertSql(
337-
"""
338-
SELECT VALUE c
339-
FROM root c
340-
WHERE (c["Discriminator"] = "Basic")
341172
""");
342173
});
343174

@@ -1151,16 +982,6 @@ public override Task Json_collection_OrderByDescending_Skip_ElementAt(bool async
1151982
() => base.Json_collection_OrderByDescending_Skip_ElementAt(async),
1152983
CosmosStrings.LimitOffsetNotSupportedInSubqueries + Environment.NewLine + CosmosStrings.LimitOffsetNotSupportedInSubqueries);
1153984

1154-
[ConditionalTheory(Skip = "issue #34349")]
1155-
public override Task Json_collection_SelectMany(bool async)
1156-
=> Fixture.NoSyncTest(
1157-
async, async a =>
1158-
{
1159-
await base.Json_collection_SelectMany(a);
1160-
1161-
AssertSql("");
1162-
});
1163-
1164985
[ConditionalTheory(Skip = "issue #34335")]
1165986
public override Task Json_collection_Select_entity_collection_ElementAt(bool async)
1166987
=> base.Json_collection_Select_entity_collection_ElementAt(async);
@@ -1324,16 +1145,6 @@ public override Task Json_nested_collection_filter_in_projection(bool async)
13241145
=> AssertTranslationFailed(
13251146
() => base.Json_nested_collection_filter_in_projection(async));
13261147

1327-
[ConditionalTheory(Skip = "issue #34349")]
1328-
public override Task Json_nested_collection_SelectMany(bool async)
1329-
=> Fixture.NoSyncTest(
1330-
async, async a =>
1331-
{
1332-
await base.Json_nested_collection_SelectMany(a);
1333-
1334-
AssertSql("");
1335-
});
1336-
13371148
public override Task Json_predicate_on_bool_converted_to_int_zero_one(bool async)
13381149
=> Fixture.NoSyncTest(
13391150
async, async a =>
@@ -2098,30 +1909,6 @@ public override Task
20981909
async),
20991910
CosmosStrings.LimitOffsetNotSupportedInSubqueries);
21001911

2101-
[ConditionalTheory(Skip = "issue #34350")]
2102-
public override Task Json_projection_with_deduplication(bool async)
2103-
=> Fixture.NoSyncTest(
2104-
async, async a =>
2105-
{
2106-
await base.Json_projection_with_deduplication(a);
2107-
2108-
AssertSql("");
2109-
});
2110-
2111-
public override Task Json_projection_with_deduplication_reverse_order(bool async)
2112-
=> Fixture.NoSyncTest(
2113-
async, async a =>
2114-
{
2115-
await base.Json_projection_with_deduplication_reverse_order(async);
2116-
2117-
AssertSql(
2118-
"""
2119-
SELECT VALUE c
2120-
FROM root c
2121-
WHERE (c["Discriminator"] = "Basic")
2122-
""");
2123-
});
2124-
21251912
public override Task Json_property_in_predicate(bool async)
21261913
=> Fixture.NoSyncTest(
21271914
async, async a =>
@@ -2314,22 +2101,6 @@ FROM root c
23142101
""");
23152102
});
23162103

2317-
public override Task Project_json_entity_FirstOrDefault_subquery(bool async)
2318-
=> AssertTranslationFailed(
2319-
() => base.Project_json_entity_FirstOrDefault_subquery(async));
2320-
2321-
public override Task Project_json_entity_FirstOrDefault_subquery_deduplication(bool async)
2322-
=> AssertTranslationFailed(
2323-
() => base.Project_json_entity_FirstOrDefault_subquery_deduplication(async));
2324-
2325-
public override Task Project_json_entity_FirstOrDefault_subquery_deduplication_and_outer_reference(bool async)
2326-
=> AssertTranslationFailed(
2327-
() => base.Project_json_entity_FirstOrDefault_subquery_deduplication_and_outer_reference(async));
2328-
2329-
public override Task Project_json_entity_FirstOrDefault_subquery_deduplication_outer_reference_and_pruning(bool async)
2330-
=> AssertTranslationFailed(
2331-
() => base.Project_json_entity_FirstOrDefault_subquery_deduplication_outer_reference_and_pruning(async));
2332-
23332104
public override Task Project_json_entity_FirstOrDefault_subquery_with_binding_on_top(bool async)
23342105
=> AssertTranslationFailed(
23352106
() => base.Project_json_entity_FirstOrDefault_subquery_with_binding_on_top(async));

0 commit comments

Comments
 (0)