-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy pathComplexPropertiesPrimitiveCollectionCosmosTest.cs
More file actions
98 lines (82 loc) · 2.3 KB
/
ComplexPropertiesPrimitiveCollectionCosmosTest.cs
File metadata and controls
98 lines (82 loc) · 2.3 KB
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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace Microsoft.EntityFrameworkCore.Query.Associations.ComplexProperties;
public class ComplexPropertiesPrimitiveCollectionCosmosTest
: ComplexPropertiesPrimitiveCollectionTestBase<ComplexPropertiesCosmosFixture>
{
public ComplexPropertiesPrimitiveCollectionCosmosTest(ComplexPropertiesCosmosFixture fixture, ITestOutputHelper outputHelper) : base(fixture)
{
Fixture.TestSqlLoggerFactory.Clear();
Fixture.TestSqlLoggerFactory.SetTestOutputHelper(outputHelper);
}
public override async Task Count()
{
await base.Count();
AssertSql(
"""
SELECT VALUE c
FROM root c
WHERE (ARRAY_LENGTH(c["RequiredAssociate"]["Ints"]) = 3)
""");
}
public override async Task Index()
{
await base.Index();
AssertSql(
"""
SELECT VALUE c
FROM root c
WHERE (c["RequiredAssociate"]["Ints"][0] = 1)
""");
}
public override async Task Contains()
{
await base.Contains();
AssertSql(
"""
SELECT VALUE c
FROM root c
WHERE ARRAY_CONTAINS(c["RequiredAssociate"]["Ints"], 3)
""");
}
public override async Task Any_predicate()
{
await base.Any_predicate();
AssertSql(
"""
SELECT VALUE c
FROM root c
WHERE ARRAY_CONTAINS(c["RequiredAssociate"]["Ints"], 2)
""");
}
public override async Task Nested_Count()
{
await base.Nested_Count();
AssertSql(
"""
SELECT VALUE c
FROM root c
WHERE (ARRAY_LENGTH(c["RequiredAssociate"]["RequiredNestedAssociate"]["Ints"]) = 3)
""");
}
[CosmosCondition(CosmosCondition.IsNotLinuxEmulator)]
public override async Task Select_Sum()
{
await base.Select_Sum();
AssertSql(
"""
SELECT VALUE (
SELECT VALUE SUM(i0)
FROM i0 IN c["RequiredAssociate"]["Ints"])
FROM root c
WHERE ((
SELECT VALUE SUM(i)
FROM i IN c["RequiredAssociate"]["Ints"]) >= 6)
""");
}
[ConditionalFact]
public virtual void Check_all_tests_overridden()
=> TestHelpers.AssertAllMethodsOverridden(GetType());
private void AssertSql(params string[] expected)
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);
}