Skip to content

Commit

Permalink
Regression test for #8334
Browse files Browse the repository at this point in the history
  • Loading branch information
smitpatel committed Nov 22, 2019
1 parent 8ccb456 commit 3e55597
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7259,6 +7259,15 @@ await AssertQuery(
ss => ss.Set<Gear>().Where(g => (g.HasSoulPatch || prm) != prm));
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Cast_OfType_works_correctly(bool async)
{
return AssertQuery(
async,
ss => ss.Set<Gear>().Cast<Gear>().OfType<Officer>().Select(o => o.FullName));
}

protected async Task AssertTranslationFailed(Func<Task> testCode)
{
Assert.Contains(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7231,6 +7231,16 @@ FROM [Gears] AS [g]
WHERE [g].[Discriminator] IN (N'Gear', N'Officer') AND ([g].[HasSoulPatch] <> @__prm_0)");
}

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

AssertSql(
@"SELECT [g].[FullName]
FROM [Gears] AS [g]
WHERE [g].[Discriminator] IN (N'Gear', N'Officer') AND ([g].[Discriminator] = N'Officer')");
}

private void AssertSql(params string[] expected)
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);
}
Expand Down

0 comments on commit 3e55597

Please sign in to comment.