Skip to content

Commit

Permalink
Query: Add regression test for #20731 (#20774)
Browse files Browse the repository at this point in the history
Fixed in #20628
  • Loading branch information
smitpatel authored Apr 28, 2020
1 parent c11deea commit 135e8da
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7469,6 +7469,18 @@ public virtual Task Constant_enum_with_same_underlying_value_as_previously_param
.Select(g => g.Rank & MilitaryRank.Private));
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Enum_array_contains(bool async)
{
var types = new[] { (AmmunitionType?)null, AmmunitionType.Cartridge };

return AssertQuery(
async,
ss => ss.Set<Weapon>()
.Where(w => w.SynergyWith != null && types.Contains(w.SynergyWith.AmmunitionType)));
}

protected GearsOfWarContext CreateContext() => Fixture.CreateContext();

protected virtual void ClearLog()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6979,6 +6979,17 @@ FROM [Gears] AS [g]
ORDER BY [g].[Nickname]");
}

public override async Task Enum_array_contains(bool async)
{
await base.Enum_array_contains(async);

AssertSql(
@"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
FROM [Weapons] AS [w]
LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id]
WHERE [w0].[Id] IS NOT NULL AND ([w0].[AmmunitionType] IN (1) OR [w0].[AmmunitionType] IS NULL)");
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public async Task DataLength_function_for_string_parameter(bool async)
Expand Down

0 comments on commit 135e8da

Please sign in to comment.