Skip to content

Commit fdaacb0

Browse files
committed
Navigation test refactoring - improving structure for scenarios that don't support collections
Plus minor cleanup Fixes #35707
1 parent a1541cb commit fdaacb0

File tree

67 files changed

+2502
-2233
lines changed

Some content is hidden

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

67 files changed

+2502
-2233
lines changed

Diff for: test/EFCore.Cosmos.FunctionalTests/Query/Relationships/InProjection/JsonRelationshipsInProjectionNoTrackingQueryCosmosTest.cs

+2-168
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Microsoft.EntityFrameworkCore.Query.Relationships.InProjection;
55

66
public class JsonRelationshipsInProjectionNoTrackingQueryCosmosTest : JsonRelationshipsInProjectionQueryTestBase<JsonRelationshipsQueryCosmosFixture>
77
{
8-
private readonly NoTrackingRewriter _noTrackingRewriter = new();
8+
private readonly TrackingRewriter _trackingRewriter = new();
99

1010
public JsonRelationshipsInProjectionNoTrackingQueryCosmosTest(JsonRelationshipsQueryCosmosFixture fixture, ITestOutputHelper testOutputHelper)
1111
: base(fixture)
@@ -16,52 +16,11 @@ public JsonRelationshipsInProjectionNoTrackingQueryCosmosTest(JsonRelationshipsQ
1616

1717
protected override Expression RewriteServerQueryExpression(Expression serverQueryExpression)
1818
{
19-
var rewritten = _noTrackingRewriter.Visit(serverQueryExpression);
19+
var rewritten = _trackingRewriter.Visit(serverQueryExpression);
2020

2121
return rewritten;
2222
}
2323

24-
public override Task Project_root(bool async)
25-
=> Fixture.NoSyncTest(
26-
async, async a =>
27-
{
28-
await base.Project_root(a);
29-
30-
AssertSql(
31-
"""
32-
SELECT VALUE c
33-
FROM root c
34-
""");
35-
});
36-
37-
public override Task Project_trunk_optional(bool async)
38-
=> Fixture.NoSyncTest(
39-
async, async a =>
40-
{
41-
await base.Project_trunk_optional(a);
42-
43-
AssertSql(
44-
"""
45-
SELECT VALUE c
46-
FROM root c
47-
ORDER BY c["Id"]
48-
""");
49-
});
50-
51-
public override Task Project_trunk_required(bool async)
52-
=> Fixture.NoSyncTest(
53-
async, async a =>
54-
{
55-
await base.Project_trunk_required(a);
56-
57-
AssertSql(
58-
"""
59-
SELECT VALUE c
60-
FROM root c
61-
ORDER BY c["Id"]
62-
""");
63-
});
64-
6524
public override Task Project_trunk_collection(bool async)
6625
=> Fixture.NoSyncTest(
6726
async, async a =>
@@ -73,34 +32,6 @@ public override Task Project_trunk_collection(bool async)
7332
SELECT VALUE c
7433
FROM root c
7534
ORDER BY c["Id"]
76-
""");
77-
});
78-
79-
public override Task Project_branch_required_required(bool async)
80-
=> Fixture.NoSyncTest(
81-
async, async a =>
82-
{
83-
await base.Project_branch_required_required(a);
84-
85-
AssertSql(
86-
"""
87-
SELECT VALUE c
88-
FROM root c
89-
ORDER BY c["Id"]
90-
""");
91-
});
92-
93-
public override Task Project_branch_required_optional(bool async)
94-
=> Fixture.NoSyncTest(
95-
async, async a =>
96-
{
97-
await base.Project_branch_required_optional(a);
98-
99-
AssertSql(
100-
"""
101-
SELECT VALUE c
102-
FROM root c
103-
ORDER BY c["Id"]
10435
""");
10536
});
10637

@@ -121,34 +52,6 @@ ORDER BY c["Id"]
12152
}
12253
}
12354

124-
public override Task Project_branch_optional_required(bool async)
125-
=> Fixture.NoSyncTest(
126-
async, async a =>
127-
{
128-
await base.Project_branch_optional_required(a);
129-
130-
AssertSql(
131-
"""
132-
SELECT VALUE c
133-
FROM root c
134-
ORDER BY c["Id"]
135-
""");
136-
});
137-
138-
public override Task Project_branch_optional_optional(bool async)
139-
=> Fixture.NoSyncTest(
140-
async, async a =>
141-
{
142-
await base.Project_branch_optional_optional(a);
143-
144-
AssertSql(
145-
"""
146-
SELECT VALUE c
147-
FROM root c
148-
ORDER BY c["Id"]
149-
""");
150-
});
151-
15255
public override async Task Project_branch_optional_collection(bool async)
15356
{
15457
if (async)
@@ -183,53 +86,6 @@ ORDER BY c["Id"]
18386
}
18487
}
18588

186-
public override Task Project_root_duplicated(bool async)
187-
=> Fixture.NoSyncTest(
188-
async, async a =>
189-
{
190-
await base.Project_root_duplicated(a);
191-
192-
AssertSql(
193-
"""
194-
SELECT VALUE c
195-
FROM root c
196-
""");
197-
});
198-
199-
public override async Task Project_trunk_and_branch_duplicated(bool async)
200-
{
201-
if (async)
202-
{
203-
//issue #31696
204-
await Assert.ThrowsAsync<NullReferenceException>(
205-
() => base.Project_trunk_and_branch_duplicated(async));
206-
207-
AssertSql(
208-
"""
209-
SELECT VALUE c
210-
FROM root c
211-
ORDER BY c["Id"]
212-
""");
213-
}
214-
}
215-
216-
public override async Task Project_trunk_and_trunk_duplicated(bool async)
217-
{
218-
if (async)
219-
{
220-
//issue #31696
221-
await Assert.ThrowsAsync<NullReferenceException>(
222-
() => base.Project_trunk_and_trunk_duplicated(async));
223-
224-
AssertSql(
225-
"""
226-
SELECT VALUE c
227-
FROM root c
228-
ORDER BY c["Id"]
229-
""");
230-
}
231-
}
232-
23389
public override async Task Project_multiple_branch_leaf(bool async)
23490
{
23591
if (async)
@@ -242,28 +98,6 @@ await Assert.ThrowsAsync<ArgumentException>(
24298
}
24399
}
244100

245-
public override Task Project_leaf_trunk_root(bool async)
246-
=> Fixture.NoSyncTest(
247-
async, async a =>
248-
{
249-
await base.Project_leaf_trunk_root(a);
250-
251-
AssertSql(
252-
"""
253-
SELECT VALUE c
254-
FROM root c
255-
""");
256-
});
257-
258-
259-
public override Task Project_subquery_root_set_required_trunk_FirstOrDefault_branch(bool async)
260-
=> AssertTranslationFailed(
261-
() => base.Project_subquery_root_set_required_trunk_FirstOrDefault_branch(async));
262-
263-
public override Task Project_subquery_root_set_optional_trunk_FirstOrDefault_branch(bool async)
264-
=> AssertTranslationFailed(
265-
() => base.Project_subquery_root_set_optional_trunk_FirstOrDefault_branch(async));
266-
267101
public override Task Project_subquery_root_set_trunk_FirstOrDefault_collection(bool async)
268102
=> AssertTranslationFailed(
269103
() => base.Project_subquery_root_set_trunk_FirstOrDefault_collection(async));

0 commit comments

Comments
 (0)