Skip to content

Commit c9d1140

Browse files
Copilotrenemadsen
andcommitted
Convert 6 additional string test overrides in NorthwindWhereQueryMySqlTest
Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
1 parent 30d6b9b commit c9d1140

File tree

1 file changed

+41
-12
lines changed

1 file changed

+41
-12
lines changed

test/EFCore.MySql.FunctionalTests/Query/NorthwindWhereQueryMySqlTest.cs

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,19 +212,27 @@ await AssertQuery(
212212
}
213213

214214
[ConditionalTheory]
215-
public override async Task Where_string_length(bool async)
215+
[ConditionalTheory]
216+
[MemberData(nameof(IsAsyncData))]
217+
public virtual async Task Where_string_length(bool async)
216218
{
217-
await base.Where_string_length(async);
219+
await AssertQuery(
220+
async,
221+
ss => ss.Set<Customer>().Where(c => c.City.Length == 6));
222+
218223
AssertSql(
219224
@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`
220225
FROM `Customers` AS `c`
221226
WHERE CHAR_LENGTH(`c`.`City`) = 6");
222227
}
223228

224229
[ConditionalTheory]
225-
public override async Task Where_string_indexof(bool async)
230+
[MemberData(nameof(IsAsyncData))]
231+
public virtual async Task Where_string_indexof(bool async)
226232
{
227-
await base.Where_string_indexof(async);
233+
await AssertQuery(
234+
async,
235+
ss => ss.Set<Customer>().Where(c => c.City.IndexOf("Sea") != -1));
228236

229237
AssertSql(
230238
@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`
@@ -233,9 +241,12 @@ public override async Task Where_string_indexof(bool async)
233241
}
234242

235243
[ConditionalTheory]
236-
public override async Task Where_string_replace(bool async)
244+
[MemberData(nameof(IsAsyncData))]
245+
public virtual async Task Where_string_replace(bool async)
237246
{
238-
await base.Where_string_replace(async);
247+
await AssertQuery(
248+
async,
249+
ss => ss.Set<Customer>().Where(c => c.City.Replace("Sea", "Rea") == "Reattle"));
239250

240251
AssertSql(
241252
@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`
@@ -244,9 +255,12 @@ public override async Task Where_string_replace(bool async)
244255
}
245256

246257
[ConditionalTheory]
247-
public override async Task Where_string_substring(bool async)
258+
[MemberData(nameof(IsAsyncData))]
259+
public virtual async Task Where_string_substring(bool async)
248260
{
249-
await base.Where_string_substring(async);
261+
await AssertQuery(
262+
async,
263+
ss => ss.Set<Customer>().Where(c => c.City.Substring(1, 2) == "ea"));
250264

251265
AssertSql(
252266
@"SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`
@@ -319,9 +333,16 @@ await AssertQuery(
319333
WHERE @__guidParameter_0 = UUID()");
320334
}
321335

322-
public override async Task Where_string_concat_method_comparison_2(bool async)
336+
[ConditionalTheory]
337+
[MemberData(nameof(IsAsyncData))]
338+
public virtual async Task Where_string_concat_method_comparison_2(bool async)
323339
{
324-
await base.Where_string_concat_method_comparison_2(async);
340+
var i = "A";
341+
var j = "B";
342+
343+
await AssertQuery(
344+
async,
345+
ss => ss.Set<Customer>().Where(c => string.Concat(i, j, c.CustomerID) == "ABANATR").Select(c => c.CustomerID));
325346

326347
AssertSql(
327348
"""
@@ -334,9 +355,17 @@ WHERE CONCAT(@__i_0, @__j_1, `c`.`CustomerID`) = 'ABANATR'
334355
""");
335356
}
336357

337-
public override async Task Where_string_concat_method_comparison_3(bool async)
358+
[ConditionalTheory]
359+
[MemberData(nameof(IsAsyncData))]
360+
public virtual async Task Where_string_concat_method_comparison_3(bool async)
338361
{
339-
await base.Where_string_concat_method_comparison_3(async);
362+
var i = "A";
363+
var j = "B";
364+
var k = "C";
365+
366+
await AssertQuery(
367+
async,
368+
ss => ss.Set<Customer>().Where(c => string.Concat(i, j, k, c.CustomerID) == "ABCANTON").Select(c => c.CustomerID));
340369

341370
AssertSql(
342371
"""

0 commit comments

Comments
 (0)