Skip to content

Commit 29de3d6

Browse files
committed
Query: Add regression test for #12295
1 parent 76ed6e9 commit 29de3d6

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs

+11
Original file line numberDiff line numberDiff line change
@@ -7333,6 +7333,17 @@ public virtual Task Byte_array_contains_parameter(bool async)
73337333
ss => ss.Set<Squad>().Where(s => s.Banner != null && s.Banner.Contains(someByte)));
73347334
}
73357335

7336+
[ConditionalTheory]
7337+
[MemberData(nameof(IsAsyncData))]
7338+
public virtual Task OrderBy_bool_coming_from_optional_navigation(bool async)
7339+
{
7340+
return AssertQuery(
7341+
async,
7342+
ss => ss.Set<Weapon>().Select(w => w.SynergyWith).OrderBy(g => g.IsAutomatic),
7343+
ss => ss.Set<Weapon>().Select(w => w.SynergyWith).OrderBy(g => MaybeScalar<bool>(g, () => g.IsAutomatic)),
7344+
assertOrder: true);
7345+
}
7346+
73367347
protected GearsOfWarContext CreateContext() => Fixture.CreateContext();
73377348

73387349
protected virtual void ClearLog()

test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs

+11
Original file line numberDiff line numberDiff line change
@@ -7333,6 +7333,17 @@ ELSE CAST(0 AS bit)
73337333
END = CAST(1 AS bit))");
73347334
}
73357335

7336+
public override async Task OrderBy_bool_coming_from_optional_navigation(bool async)
7337+
{
7338+
await base.OrderBy_bool_coming_from_optional_navigation(async);
7339+
7340+
AssertSql(
7341+
@"SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId]
7342+
FROM [Weapons] AS [w]
7343+
LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id]
7344+
ORDER BY [w0].[IsAutomatic]");
7345+
}
7346+
73367347
private void AssertSql(params string[] expected)
73377348
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);
73387349
}

0 commit comments

Comments
 (0)