Skip to content

Commit 15a0f6f

Browse files
committed
more tests
1 parent 0c46321 commit 15a0f6f

8 files changed

+155
-133
lines changed

src/Tests/IntegrationTests/IntegrationTests.Where_string_contains.verified.txt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,30 @@
55
"stringEntities": [
66
{
77
"id": "Guid_1",
8-
"property": "b"
8+
"property": "ab"
99
},
1010
{
1111
"id": "Guid_2",
12-
"property": "ab"
12+
"property": "abc"
1313
},
1414
{
1515
"id": "Guid_3",
16-
"property": "bc"
16+
"property": "b"
1717
},
1818
{
1919
"id": "Guid_4",
20-
"property": "abc"
20+
"property": "bc"
2121
}
2222
]
2323
}
2424
},
2525
sql: {
2626
Text:
27-
select s.Id,
28-
s.Property
29-
from StringEntities as s
30-
where s.Property is not null
31-
and cast (CHARINDEX(N'b', s.Property) as int) - 1 <> -1
27+
select s.Id,
28+
s.Property
29+
from StringEntities as s
30+
where s.Property is not null
31+
and cast (CHARINDEX(N'b', s.Property) as int) - 1 <> -1
32+
order by s.Property
3233
}
3334
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
target:
3+
{
4+
"data": {
5+
"stringEntities": [
6+
{
7+
"id": "Guid_1",
8+
"property": "ab"
9+
},
10+
{
11+
"id": "Guid_2",
12+
"property": "abc"
13+
},
14+
{
15+
"id": "Guid_3",
16+
"property": "b"
17+
},
18+
{
19+
"id": "Guid_4",
20+
"property": "bc"
21+
}
22+
]
23+
}
24+
},
25+
sql: {
26+
Text:
27+
select s.Id,
28+
s.Property
29+
from StringEntities as s
30+
where s.Property is not null
31+
and cast (CHARINDEX(N'B', s.Property) as int) - 1 <> -1
32+
order by s.Property
33+
}
34+
}

src/Tests/IntegrationTests/IntegrationTests.Where_string_notEqual.verified.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,22 @@
55
"stringEntities": [
66
{
77
"id": "Guid_1",
8-
"property": "Value"
8+
"property": null
99
},
1010
{
1111
"id": "Guid_2",
12-
"property": null
12+
"property": "Value"
1313
}
1414
]
1515
}
1616
},
1717
sql: {
1818
Text:
19-
select s.Id,
20-
s.Property
21-
from StringEntities as s
22-
where s.Property <> N'notValue'
23-
or s.Property is null
19+
select s.Id,
20+
s.Property
21+
from StringEntities as s
22+
where s.Property <> N'notValue'
23+
or s.Property is null
24+
order by s.Property
2425
}
2526
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
target:
3+
{
4+
"data": {
5+
"stringEntities": [
6+
{
7+
"id": "Guid_1",
8+
"property": null
9+
},
10+
{
11+
"id": "Guid_2",
12+
"property": "Value"
13+
}
14+
]
15+
}
16+
},
17+
sql: {
18+
Text:
19+
select s.Id,
20+
s.Property
21+
from StringEntities as s
22+
where s.Property <> N'NotValue'
23+
or s.Property is null
24+
order by s.Property
25+
}
26+
}

src/Tests/IntegrationTests/IntegrationTests.cs

Lines changed: 77 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,34 @@ public async Task Where_string_notEqual()
221221
var query =
222222
"""
223223
{
224-
stringEntities (where: {path: "Property", comparison: notEqual, value: "notValue"})
224+
stringEntities (orderBy: {path: "property"}, where: {path: "Property", comparison: notEqual, value: "notValue"})
225+
{
226+
id, property
227+
}
228+
}
229+
""";
230+
231+
var entity1 = new StringEntity();
232+
var entity2 = new StringEntity
233+
{
234+
Property = "Value"
235+
};
236+
var entity3 = new StringEntity
237+
{
238+
Property = "notValue"
239+
};
240+
241+
await using var database = await sqlInstance.Build();
242+
await RunQuery(database, query, null, null, false, [entity1, entity2, entity3]);
243+
}
244+
245+
[Fact]
246+
public async Task Where_string_notEqual_diffCase()
247+
{
248+
var query =
249+
"""
250+
{
251+
stringEntities (orderBy: {path: "property"}, where: {path: "Property", comparison: notEqual, value: "NotValue"})
225252
{
226253
id, property
227254
}
@@ -248,7 +275,54 @@ public async Task Where_string_contains()
248275
var query =
249276
"""
250277
{
251-
stringEntities (where: {path: "Property", comparison: contains, value: "b" })
278+
stringEntities (orderBy: {path: "property"}, where: {path: "Property", comparison: contains, value: "b" })
279+
{
280+
id, property
281+
}
282+
}
283+
""";
284+
285+
var entity1 = new StringEntity();
286+
var entity2 = new StringEntity
287+
{
288+
Property = "a"
289+
};
290+
var entity3 = new StringEntity
291+
{
292+
Property = "ab"
293+
};
294+
var entity4 = new StringEntity
295+
{
296+
Property = "abc"
297+
};
298+
var entity5 = new StringEntity
299+
{
300+
Property = "bc"
301+
};
302+
var entity6 = new StringEntity
303+
{
304+
Property = "c"
305+
};
306+
var entity7 = new StringEntity
307+
{
308+
Property = "b"
309+
};
310+
var entity8 = new StringEntity
311+
{
312+
Property = ""
313+
};
314+
315+
await using var database = await sqlInstance.Build();
316+
await RunQuery(database, query, null, null, false, [entity1, entity2, entity3, entity4, entity5, entity6, entity7, entity8]);
317+
}
318+
319+
[Fact]
320+
public async Task Where_string_contains_diffCase()
321+
{
322+
var query =
323+
"""
324+
{
325+
stringEntities (orderBy: {path: "property"}, where: {path: "Property", comparison: contains, value: "B" })
252326
{
253327
id, property
254328
}
@@ -289,6 +363,7 @@ public async Task Where_string_contains()
289363
await RunQuery(database, query, null, null, false, [entity1, entity2, entity3, entity4, entity5, entity6, entity7, entity8]);
290364
}
291365

366+
292367
[Fact]
293368
public async Task Where_enum_in()
294369
{
@@ -690,58 +765,6 @@ static IEnumerable<ParentEntity> BuildEntities(uint length)
690765
}
691766
}
692767

693-
[Fact(Skip = "Work out how to eval server side")]
694-
public async Task Where_case_sensitive()
695-
{
696-
var query =
697-
"""
698-
{
699-
parentEntities (where: {path: "Property", comparison: equal, value: "Value2", case: "Ordinal" })
700-
{
701-
property
702-
}
703-
}
704-
""";
705-
706-
var entity1 = new ParentEntity
707-
{
708-
Property = "Value1"
709-
};
710-
var entity2 = new ParentEntity
711-
{
712-
Property = "Value2"
713-
};
714-
715-
await using var database = await sqlInstance.Build();
716-
await RunQuery(database, query, null, null, false, [entity1, entity2]);
717-
}
718-
719-
[Fact(Skip = "Work out how to eval server side")]
720-
public async Task Where_case_sensitive_notEqual()
721-
{
722-
var query =
723-
"""
724-
{
725-
parentEntities (where: {path: "Property", comparison: notEqual, value: "Value2", case: "Ordinal" })
726-
{
727-
property
728-
}
729-
}
730-
""";
731-
732-
var entity1 = new ParentEntity
733-
{
734-
Property = "Value1"
735-
};
736-
var entity2 = new ParentEntity
737-
{
738-
Property = "Value2"
739-
};
740-
741-
await using var database = await sqlInstance.Build();
742-
await RunQuery(database, query, null, null, false, [entity1, entity2]);
743-
}
744-
745768
[Fact]
746769
public async Task OrderBy()
747770
{
@@ -1810,32 +1833,6 @@ public async Task Where_default_comparison()
18101833
await RunQuery(database, query, null, null, false, [entity1, entity2]);
18111834
}
18121835

1813-
[Fact(Skip = "Work out how to eval server side")]
1814-
public async Task In_case_sensitive()
1815-
{
1816-
var query =
1817-
"""
1818-
{
1819-
parentEntities (where: {path: "Property", comparison: in, value: "Value2", case: "Ordinal" })
1820-
{
1821-
property
1822-
}
1823-
}
1824-
""";
1825-
1826-
var entity1 = new ParentEntity
1827-
{
1828-
Property = "Value1"
1829-
};
1830-
var entity2 = new ParentEntity
1831-
{
1832-
Property = "Value2"
1833-
};
1834-
1835-
await using var database = await sqlInstance.Build();
1836-
await RunQuery(database, query, null, null, false, [entity1, entity2]);
1837-
}
1838-
18391836
[Fact]
18401837
public async Task Id()
18411838
{

src/Tests/IntegrationTests/IntegrationTests_filtered.Child_filtered.verified.txt

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/Tests/IntegrationTests/IntegrationTests_filtered.RootList_filtered.verified.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/Tests/IntegrationTests/IntegrationTests_filtered.Root_connectionFiltered.verified.txt

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)