Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
cincuranet committed Mar 14, 2024
1 parent 7405990 commit fed3e53
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1858,12 +1858,12 @@ public virtual Task Where_DateOnly_FromDateTime(bool async)
public virtual Task Select_ToString_IndexOf(bool async)
=> AssertQuery(
async,
ss => ss.Set<Order>().Select(x => x.OrderID.ToString().IndexOf("123")));
ss => ss.Set<Order>().Where(x => x.OrderID.ToString().IndexOf("123") == -1));

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Select_IndexOf_ToString(bool async)
=> AssertQuery(
async,
ss => ss.Set<Order>().Select(x => "123".IndexOf(x.OrderID.ToString())));
ss => ss.Set<Order>().Where(x => "123".IndexOf(x.OrderID.ToString()) == -1));
}
Original file line number Diff line number Diff line change
Expand Up @@ -2729,8 +2729,9 @@ public override async Task Select_ToString_IndexOf(bool async)

AssertSql(
"""
SELECT CAST(CHARINDEX(N'123', CONVERT(varchar(11), [o].[OrderID])) AS int) - 1
SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate]
FROM [Orders] AS [o]
WHERE CAST(CHARINDEX(N'123', CONVERT(varchar(11), [o].[OrderID])) AS int) - 1 = -1
""");
}

Expand All @@ -2740,11 +2741,12 @@ public override async Task Select_IndexOf_ToString(bool async)

AssertSql(
"""
SELECT CASE
SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate]
FROM [Orders] AS [o]
WHERE CASE
WHEN CONVERT(varchar(11), [o].[OrderID]) = N'' THEN 0
ELSE CAST(CHARINDEX(CONVERT(varchar(11), [o].[OrderID]), N'123') AS int) - 1
END
FROM [Orders] AS [o]
END = -1
""");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1486,8 +1486,9 @@ public override async Task Select_ToString_IndexOf(bool async)

AssertSql(
"""
SELECT instr(CAST("o"."OrderID" AS TEXT), '123') - 1
SELECT "o"."OrderID", "o"."CustomerID", "o"."EmployeeID", "o"."OrderDate"
FROM "Orders" AS "o"
WHERE instr(CAST("o"."OrderID" AS TEXT), '123') - 1 = -1
""");
}

Expand All @@ -1497,8 +1498,9 @@ public override async Task Select_IndexOf_ToString(bool async)

AssertSql(
"""
SELECT instr('123', CAST("o"."OrderID" AS TEXT)) - 1
SELECT "o"."OrderID", "o"."CustomerID", "o"."EmployeeID", "o"."OrderDate"
FROM "Orders" AS "o"
WHERE instr('123', CAST("o"."OrderID" AS TEXT)) - 1 = -1
""");
}

Expand Down

0 comments on commit fed3e53

Please sign in to comment.