-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
NorthwindKeylessEntitiesQueryCosmosTest.cs
203 lines (163 loc) · 5.77 KB
/
NorthwindKeylessEntitiesQueryCosmosTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Xunit.Sdk;
namespace Microsoft.EntityFrameworkCore.Query;
public class NorthwindKeylessEntitiesQueryCosmosTest : NorthwindKeylessEntitiesQueryTestBase<
NorthwindQueryCosmosFixture<NoopModelCustomizer>>
{
public NorthwindKeylessEntitiesQueryCosmosTest(
NorthwindQueryCosmosFixture<NoopModelCustomizer> fixture,
ITestOutputHelper testOutputHelper)
: base(fixture)
{
ClearLog();
//Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper);
}
[ConditionalFact]
public virtual void Check_all_tests_overridden()
=> TestHelpers.AssertAllMethodsOverridden(GetType());
public override async Task KeylessEntity_simple(bool async)
{
await base.KeylessEntity_simple(async);
AssertSql(
"""
SELECT c
FROM root c
WHERE (c["Discriminator"] = "Customer")
""");
}
public override async Task KeylessEntity_where_simple(bool async)
{
await base.KeylessEntity_where_simple(async);
AssertSql(
"""
SELECT c
FROM root c
WHERE ((c["Discriminator"] = "Customer") AND (c["City"] = "London"))
""");
}
public override async Task KeylessEntity_by_database_view(bool async)
{
// Views are not supported.
Assert.Equal(
"0",
(await Assert.ThrowsAsync<EqualException>(
() => base.KeylessEntity_by_database_view(async))).Actual);
AssertSql(
"""
SELECT c
FROM root c
WHERE (c["Discriminator"] = "ProductView")
""");
}
public override async Task Entity_mapped_to_view_on_right_side_of_join(bool async)
{
await AssertTranslationFailed(() => base.Entity_mapped_to_view_on_right_side_of_join(async));
AssertSql();
}
public override async Task KeylessEntity_with_nav_defining_query(bool async)
{
Assert.Equal(
"0",
(await Assert.ThrowsAsync<EqualException>(
() => base.KeylessEntity_with_nav_defining_query(async))).Actual);
AssertSql(
"""
SELECT c
FROM root c
WHERE ((c["Discriminator"] = "Customer") AND (c["OrderCount"] > 0))
""");
}
public override async Task KeylessEntity_with_mixed_tracking(bool async)
{
// Cosmos client evaluation. Issue #17246.
await AssertTranslationFailed(() => base.KeylessEntity_with_mixed_tracking(async));
AssertSql();
}
public override async Task KeylessEntity_with_included_nav(bool async)
{
// Cosmos client evaluation. Issue #17246.
await AssertTranslationFailed(() => base.KeylessEntity_with_included_nav(async));
AssertSql();
}
public override async Task KeylessEntity_with_defining_query(bool async)
{
await base.KeylessEntity_with_defining_query(async);
AssertSql(
"""
SELECT c
FROM root c
WHERE ((c["Discriminator"] = "Order") AND (c["CustomerID"] = "ALFKI"))
""");
}
public override async Task KeylessEntity_with_defining_query_and_correlated_collection(bool async)
{
// Cosmos client evaluation. Issue #17246.
await AssertTranslationFailed(() => base.KeylessEntity_with_defining_query_and_correlated_collection(async));
AssertSql();
}
public override async Task KeylessEntity_select_where_navigation(bool async)
{
// Left join translation. Issue #17314.
await AssertTranslationFailed(() => base.KeylessEntity_select_where_navigation(async));
AssertSql();
}
public override async Task KeylessEntity_select_where_navigation_multi_level(bool async)
{
// Left join translation. Issue #17314.
await AssertTranslationFailed(() => base.KeylessEntity_select_where_navigation_multi_level(async));
AssertSql();
}
public override async Task KeylessEntity_with_included_navs_multi_level(bool async)
{
// Left join translation. Issue #17314.
await AssertTranslationFailed(() => base.KeylessEntity_with_included_navs_multi_level(async));
AssertSql();
}
public override async Task KeylessEntity_groupby(bool async)
{
// Cosmos client evaluation. Issue #17246.
await AssertTranslationFailed(() => base.KeylessEntity_groupby(async));
AssertSql();
}
public override async Task Collection_correlated_with_keyless_entity_in_predicate_works(bool async)
{
// Cosmos client evaluation. Issue #17246.
await AssertTranslationFailed(() => base.Collection_correlated_with_keyless_entity_in_predicate_works(async));
AssertSql();
}
public override async Task Auto_initialized_view_set(bool async)
{
await base.Auto_initialized_view_set(async);
AssertSql(
"""
SELECT c
FROM root c
WHERE (c["Discriminator"] = "Customer")
""");
}
public override async Task Count_over_keyless_entity(bool async)
{
await base.Count_over_keyless_entity(async);
AssertSql(
"""
SELECT COUNT(1) AS c
FROM root c
WHERE (c["Discriminator"] = "Customer")
""");
}
public override async Task Count_over_keyless_entity_with_pushdown(bool async)
{
// Cosmos client evaluation. Issue #17246.
await AssertTranslationFailed(() => base.Count_over_keyless_entity_with_pushdown(async));
}
public override async Task Count_over_keyless_entity_with_pushdown_empty_projection(bool async)
{
// Cosmos client evaluation. Issue #17246.
await AssertTranslationFailed(() => base.Count_over_keyless_entity_with_pushdown_empty_projection(async));
}
private void AssertSql(params string[] expected)
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);
protected override void ClearLog()
=> Fixture.TestSqlLoggerFactory.Clear();
}