Skip to content

Commit 135e8da

Browse files
authored
Query: Add regression test for #20731 (#20774)
Fixed in #20628
1 parent c11deea commit 135e8da

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7469,6 +7469,18 @@ public virtual Task Constant_enum_with_same_underlying_value_as_previously_param
74697469
.Select(g => g.Rank & MilitaryRank.Private));
74707470
}
74717471

7472+
[ConditionalTheory]
7473+
[MemberData(nameof(IsAsyncData))]
7474+
public virtual Task Enum_array_contains(bool async)
7475+
{
7476+
var types = new[] { (AmmunitionType?)null, AmmunitionType.Cartridge };
7477+
7478+
return AssertQuery(
7479+
async,
7480+
ss => ss.Set<Weapon>()
7481+
.Where(w => w.SynergyWith != null && types.Contains(w.SynergyWith.AmmunitionType)));
7482+
}
7483+
74727484
protected GearsOfWarContext CreateContext() => Fixture.CreateContext();
74737485

74747486
protected virtual void ClearLog()

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6979,6 +6979,17 @@ FROM [Gears] AS [g]
69796979
ORDER BY [g].[Nickname]");
69806980
}
69816981

6982+
public override async Task Enum_array_contains(bool async)
6983+
{
6984+
await base.Enum_array_contains(async);
6985+
6986+
AssertSql(
6987+
@"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
6988+
FROM [Weapons] AS [w]
6989+
LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id]
6990+
WHERE [w0].[Id] IS NOT NULL AND ([w0].[AmmunitionType] IN (1) OR [w0].[AmmunitionType] IS NULL)");
6991+
}
6992+
69826993
[ConditionalTheory]
69836994
[MemberData(nameof(IsAsyncData))]
69846995
public async Task DataLength_function_for_string_parameter(bool async)

0 commit comments

Comments
 (0)