diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/SimpleQueryCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/SimpleQueryCosmosTest.cs index 860abd8cdcf..fc42706c0f6 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/SimpleQueryCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/SimpleQueryCosmosTest.cs @@ -4043,6 +4043,12 @@ public override Task Inner_parameter_in_nested_lambdas_gets_preserved(bool isAsy return base.Inner_parameter_in_nested_lambdas_gets_preserved(isAsync); } + [ConditionalTheory(Skip = "Issue #14935")] + public override Task Navigation_inside_interpolated_string_is_expanded(bool isAsync) + { + return base.Navigation_inside_interpolated_string_is_expanded(isAsync); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); diff --git a/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs index a2c82ae43a9..f12c5751331 100644 --- a/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs @@ -7474,6 +7474,15 @@ public virtual Task DateTimeOffset_Contains_Less_than_Greater_than(bool isAsync) dates.Contains(m.Timeline))); } + [ConditionalTheory] // issue #16724 + [MemberData(nameof(IsAsyncData))] + public virtual Task Navigation_inside_interpolated_string_expanded(bool isAsync) + { + return AssertQuery( + isAsync, + ws => ws.Select(w => w.SynergyWithId.HasValue ? $"SynergyWithOwner: {w.SynergyWith.OwnerFullName}" : string.Empty)); + } + protected GearsOfWarContext CreateContext() => Fixture.CreateContext(); protected virtual void ClearLog() diff --git a/test/EFCore.Specification.Tests/Query/QueryTestBase.cs b/test/EFCore.Specification.Tests/Query/QueryTestBase.cs index a72ce2b4fdc..bd06baa0601 100644 --- a/test/EFCore.Specification.Tests/Query/QueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/QueryTestBase.cs @@ -27,40 +27,40 @@ public abstract class QueryTestBase : IClassFixture #region AssertAny - protected virtual Task AssertAny( + protected Task AssertAny( bool isAsync, Func, IQueryable> query) where TItem1 : class => AssertAny(isAsync, query, query); - protected virtual Task AssertAny( + protected Task AssertAny( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery) where TItem1 : class => Fixture.QueryAsserter.AssertAny(actualQuery, expectedQuery, isAsync); - protected virtual Task AssertAny( + protected Task AssertAny( bool isAsync, Func, IQueryable> query) where TItem1 : class => AssertAny(isAsync, query, query); - protected virtual Task AssertAny( + protected Task AssertAny( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery) where TItem1 : class => Fixture.QueryAsserter.AssertAny(actualQuery, expectedQuery, isAsync); - protected virtual Task AssertAny( + protected Task AssertAny( bool isAsync, Func, IQueryable, IQueryable> query) where TItem1 : class where TItem2 : class => AssertAny(isAsync, query, query); - protected virtual Task AssertAny( + protected Task AssertAny( bool isAsync, Func, IQueryable, IQueryable> actualQuery, Func, IQueryable, IQueryable> expectedQuery) @@ -68,7 +68,7 @@ protected virtual Task AssertAny( where TItem2 : class => Fixture.QueryAsserter.AssertAny(actualQuery, expectedQuery, isAsync); - protected virtual Task AssertAny( + protected Task AssertAny( bool isAsync, Func, IQueryable, IQueryable, IQueryable> query) where TItem1 : class @@ -76,7 +76,7 @@ protected virtual Task AssertAny( where TItem3 : class => AssertAny(isAsync, query, query); - protected virtual Task AssertAny( + protected Task AssertAny( bool isAsync, Func, IQueryable, IQueryable, IQueryable> actualQuery, Func, IQueryable, IQueryable, IQueryable> expectedQuery) @@ -85,14 +85,14 @@ protected virtual Task AssertAny( where TItem3 : class => Fixture.QueryAsserter.AssertAny(actualQuery, expectedQuery, isAsync); - protected virtual Task AssertAny( + protected Task AssertAny( bool isAsync, Func, IQueryable> query, Expression> predicate) where TItem1 : class => AssertAny(isAsync, query, query, predicate, predicate); - protected virtual Task AssertAny( + protected Task AssertAny( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -105,14 +105,14 @@ protected virtual Task AssertAny( #region AssertAll - protected virtual Task AssertAll( + protected Task AssertAll( bool isAsync, Func, IQueryable> query, Expression> predicate) where TItem1 : class => AssertAll(isAsync, query, query, predicate, predicate); - protected virtual Task AssertAll( + protected Task AssertAll( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -125,7 +125,7 @@ protected virtual Task AssertAll( #region AssertFirst - protected virtual Task AssertFirst( + protected Task AssertFirst( bool isAsync, Func, IQueryable> query, Action asserter = null, @@ -133,7 +133,7 @@ protected virtual Task AssertFirst( where TItem1 : class => AssertFirst(isAsync, query, query, asserter, entryCount); - protected virtual Task AssertFirst( + protected Task AssertFirst( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -142,7 +142,7 @@ protected virtual Task AssertFirst( where TItem1 : class => Fixture.QueryAsserter.AssertFirst(actualQuery, expectedQuery, asserter, entryCount, isAsync); - protected virtual Task AssertFirst( + protected Task AssertFirst( bool isAsync, Func, IQueryable> query, Expression> predicate, @@ -151,7 +151,7 @@ protected virtual Task AssertFirst( where TItem1 : class => AssertFirst(isAsync, query, query, predicate, predicate, asserter, entryCount); - protected virtual Task AssertFirst( + protected Task AssertFirst( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -167,7 +167,7 @@ protected virtual Task AssertFirst( #region AssertFirstOrDefault - protected virtual Task AssertFirstOrDefault( + protected Task AssertFirstOrDefault( bool isAsync, Func, IQueryable> query, Action asserter = null, @@ -175,7 +175,7 @@ protected virtual Task AssertFirstOrDefault( where TItem1 : class => AssertFirstOrDefault(isAsync, query, query, asserter, entryCount); - protected virtual Task AssertFirstOrDefault( + protected Task AssertFirstOrDefault( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -184,7 +184,7 @@ protected virtual Task AssertFirstOrDefault( where TItem1 : class => Fixture.QueryAsserter.AssertFirstOrDefault(actualQuery, expectedQuery, asserter, entryCount, isAsync); - protected virtual Task AssertFirstOrDefault( + protected Task AssertFirstOrDefault( bool isAsync, Func, IQueryable, IQueryable> query, Action asserter = null, @@ -193,7 +193,7 @@ protected virtual Task AssertFirstOrDefault( where TItem2 : class => AssertFirstOrDefault(isAsync, query, query, asserter, entryCount); - protected virtual Task AssertFirstOrDefault( + protected Task AssertFirstOrDefault( bool isAsync, Func, IQueryable, IQueryable> actualQuery, Func, IQueryable, IQueryable> expectedQuery, @@ -203,7 +203,7 @@ protected virtual Task AssertFirstOrDefault( where TItem2 : class => Fixture.QueryAsserter.AssertFirstOrDefault(actualQuery, expectedQuery, asserter, entryCount, isAsync); - protected virtual Task AssertFirstOrDefault( + protected Task AssertFirstOrDefault( bool isAsync, Func, IQueryable, IQueryable, IQueryable> query, Action asserter = null, @@ -213,7 +213,7 @@ protected virtual Task AssertFirstOrDefault( where TItem3 : class => AssertFirstOrDefault(isAsync, query, query, asserter, entryCount); - protected virtual Task AssertFirstOrDefault( + protected Task AssertFirstOrDefault( bool isAsync, Func, IQueryable, IQueryable, IQueryable> actualQuery, Func, IQueryable, IQueryable, IQueryable> expectedQuery, @@ -224,7 +224,7 @@ protected virtual Task AssertFirstOrDefault( where TItem3 : class => Fixture.QueryAsserter.AssertFirstOrDefault(actualQuery, expectedQuery, asserter, entryCount, isAsync); - protected virtual Task AssertFirstOrDefault( + protected Task AssertFirstOrDefault( bool isAsync, Func, IQueryable> query, Expression> predicate, @@ -233,7 +233,7 @@ protected virtual Task AssertFirstOrDefault( where TItem1 : class => AssertFirstOrDefault(isAsync, query, query, predicate, predicate, asserter, entryCount); - protected virtual Task AssertFirstOrDefault( + protected Task AssertFirstOrDefault( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -249,7 +249,7 @@ protected virtual Task AssertFirstOrDefault( #region AssertSingle - protected virtual Task AssertSingle( + protected Task AssertSingle( bool isAsync, Func, IQueryable> query, Action asserter = null, @@ -257,7 +257,7 @@ protected virtual Task AssertSingle( where TItem1 : class => AssertSingle(isAsync, query, query, asserter, entryCount); - protected virtual Task AssertSingle( + protected Task AssertSingle( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -266,7 +266,7 @@ protected virtual Task AssertSingle( where TItem1 : class => Fixture.QueryAsserter.AssertSingle(actualQuery, expectedQuery, asserter, entryCount, isAsync); - protected virtual Task AssertSingle( + protected Task AssertSingle( bool isAsync, Func, IQueryable, IQueryable> query, Action asserter = null, @@ -275,7 +275,7 @@ protected virtual Task AssertSingle( where TItem2 : class => AssertSingle(isAsync, query, query, asserter, entryCount); - protected virtual Task AssertSingle( + protected Task AssertSingle( bool isAsync, Func, IQueryable, IQueryable> actualQuery, Func, IQueryable, IQueryable> expectedQuery, @@ -285,7 +285,7 @@ protected virtual Task AssertSingle( where TItem2 : class => Fixture.QueryAsserter.AssertSingle(actualQuery, expectedQuery, asserter, entryCount, isAsync); - protected virtual Task AssertSingle( + protected Task AssertSingle( bool isAsync, Func, IQueryable> query, Expression> predicate, @@ -294,7 +294,7 @@ protected virtual Task AssertSingle( where TItem1 : class => AssertSingle(isAsync, query, query, predicate, predicate, asserter, entryCount); - protected virtual Task AssertSingle( + protected Task AssertSingle( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -310,7 +310,7 @@ protected virtual Task AssertSingle( #region AssertSingleOrDefault - protected virtual Task AssertSingleOrDefault( + protected Task AssertSingleOrDefault( bool isAsync, Func, IQueryable> query, Action asserter = null, @@ -318,7 +318,7 @@ protected virtual Task AssertSingleOrDefault( where TItem1 : class => AssertSingleOrDefault(isAsync, query, query, asserter, entryCount); - protected virtual Task AssertSingleOrDefault( + protected Task AssertSingleOrDefault( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -327,7 +327,7 @@ protected virtual Task AssertSingleOrDefault( where TItem1 : class => Fixture.QueryAsserter.AssertSingleOrDefault(actualQuery, expectedQuery, asserter, entryCount, isAsync); - protected virtual Task AssertSingleOrDefault( + protected Task AssertSingleOrDefault( bool isAsync, Func, IQueryable> query, Expression> predicate, @@ -336,7 +336,7 @@ protected virtual Task AssertSingleOrDefault( where TItem1 : class => AssertSingleOrDefault(isAsync, query, query, predicate, predicate, asserter, entryCount); - protected virtual Task AssertSingleOrDefault( + protected Task AssertSingleOrDefault( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -352,7 +352,7 @@ protected virtual Task AssertSingleOrDefault( #region AssertLast - protected virtual Task AssertLast( + protected Task AssertLast( bool isAsync, Func, IQueryable> query, Action asserter = null, @@ -360,7 +360,7 @@ protected virtual Task AssertLast( where TItem1 : class => AssertLast(isAsync, query, query, asserter, entryCount); - protected virtual Task AssertLast( + protected Task AssertLast( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -369,7 +369,7 @@ protected virtual Task AssertLast( where TItem1 : class => Fixture.QueryAsserter.AssertLast(actualQuery, expectedQuery, asserter, entryCount, isAsync); - protected virtual Task AssertLast( + protected Task AssertLast( bool isAsync, Func, IQueryable> query, Expression> predicate, @@ -378,7 +378,7 @@ protected virtual Task AssertLast( where TItem1 : class => AssertLast(isAsync, query, query, predicate, predicate, asserter, entryCount); - protected virtual Task AssertLast( + protected Task AssertLast( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -394,7 +394,7 @@ protected virtual Task AssertLast( #region AssertLastOrDefault - protected virtual Task AssertLastOrDefault( + protected Task AssertLastOrDefault( bool isAsync, Func, IQueryable> query, Action asserter = null, @@ -402,7 +402,7 @@ protected virtual Task AssertLastOrDefault( where TItem1 : class => AssertLastOrDefault(isAsync, query, query, asserter, entryCount); - protected virtual Task AssertLastOrDefault( + protected Task AssertLastOrDefault( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -411,7 +411,7 @@ protected virtual Task AssertLastOrDefault( where TItem1 : class => Fixture.QueryAsserter.AssertLastOrDefault(actualQuery, expectedQuery, asserter, entryCount, isAsync); - protected virtual Task AssertLastOrDefault( + protected Task AssertLastOrDefault( bool isAsync, Func, IQueryable> query, Expression> predicate, @@ -420,7 +420,7 @@ protected virtual Task AssertLastOrDefault( where TItem1 : class => AssertLastOrDefault(isAsync, query, query, predicate, predicate, asserter, entryCount); - protected virtual Task AssertLastOrDefault( + protected Task AssertLastOrDefault( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -436,40 +436,40 @@ protected virtual Task AssertLastOrDefault( #region AssertCount - protected virtual Task AssertCount( + protected Task AssertCount( bool isAsync, Func, IQueryable> query) where TItem1 : class => AssertCount(isAsync, query, query); - protected virtual Task AssertCount( + protected Task AssertCount( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery) where TItem1 : class => Fixture.QueryAsserter.AssertCount(actualQuery, expectedQuery, isAsync); - protected virtual Task AssertCount( + protected Task AssertCount( bool isAsync, Func, IQueryable> query) where TItem1 : class => AssertCount(isAsync, query, query); - protected virtual Task AssertCount( + protected Task AssertCount( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery) where TItem1 : class => Fixture.QueryAsserter.AssertCount(actualQuery, expectedQuery, isAsync); - protected virtual Task AssertCount( + protected Task AssertCount( bool isAsync, Func, IQueryable> query, Expression> predicate) where TItem1 : class => AssertCount(isAsync, query, query, predicate, predicate); - protected virtual Task AssertCount( + protected Task AssertCount( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -478,14 +478,14 @@ protected virtual Task AssertCount( where TItem1 : class => Fixture.QueryAsserter.AssertCount(actualQuery, expectedQuery, actualPredicate, expectedPredicate, isAsync); - protected virtual Task AssertCount( + protected Task AssertCount( bool isAsync, Func, IQueryable, IQueryable> query) where TItem1 : class where TItem2 : class => AssertCount(isAsync, query, query); - protected virtual Task AssertCount( + protected Task AssertCount( bool isAsync, Func, IQueryable, IQueryable> actualQuery, Func, IQueryable, IQueryable> expectedQuery) @@ -497,27 +497,27 @@ protected virtual Task AssertCount( #region AssertLongCount - protected virtual Task AssertLongCount( + protected Task AssertLongCount( bool isAsync, Func, IQueryable> query) where TItem1 : class => AssertLongCount(isAsync, query, query); - protected virtual Task AssertLongCount( + protected Task AssertLongCount( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery) where TItem1 : class => Fixture.QueryAsserter.AssertLongCount(actualQuery, expectedQuery, isAsync); - protected virtual Task AssertLongCount( + protected Task AssertLongCount( bool isAsync, Func, IQueryable, IQueryable> query) where TItem1 : class where TItem2 : class => AssertLongCount(isAsync, query, query); - protected virtual Task AssertLongCount( + protected Task AssertLongCount( bool isAsync, Func, IQueryable, IQueryable> actualQuery, Func, IQueryable, IQueryable> expectedQuery) @@ -529,7 +529,7 @@ protected virtual Task AssertLongCount( #region AssertMin - protected virtual Task AssertMin( + protected Task AssertMin( bool isAsync, Func, IQueryable> query, Action asserter = null, @@ -537,7 +537,7 @@ protected virtual Task AssertMin( where TItem1 : class => AssertMin(isAsync, query, query, asserter, entryCount); - protected virtual Task AssertMin( + protected Task AssertMin( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -546,7 +546,7 @@ protected virtual Task AssertMin( where TItem1 : class => Fixture.QueryAsserter.AssertMin(actualQuery, expectedQuery, asserter, entryCount, isAsync); - protected virtual Task AssertMin( + protected Task AssertMin( bool isAsync, Func, IQueryable> query, Action asserter = null, @@ -554,7 +554,7 @@ protected virtual Task AssertMin( where TItem1 : class => AssertMin(isAsync, query, query, asserter, entryCount); - protected virtual Task AssertMin( + protected Task AssertMin( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -563,7 +563,7 @@ protected virtual Task AssertMin( where TItem1 : class => Fixture.QueryAsserter.AssertMin(actualQuery, expectedQuery, asserter, entryCount, isAsync); - protected virtual Task AssertMin( + protected Task AssertMin( bool isAsync, Func, IQueryable> query, Action asserter = null, @@ -571,7 +571,7 @@ protected virtual Task AssertMin( where TItem1 : class => AssertMin(isAsync, query, query, asserter, entryCount); - protected virtual Task AssertMin( + protected Task AssertMin( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -580,7 +580,7 @@ protected virtual Task AssertMin( where TItem1 : class => Fixture.QueryAsserter.AssertMin(actualQuery, expectedQuery, asserter, entryCount, isAsync); - protected virtual Task AssertMin( + protected Task AssertMin( bool isAsync, Func, IQueryable> query, Expression> selector, @@ -589,7 +589,7 @@ protected virtual Task AssertMin( where TItem1 : class => AssertMin(isAsync, query, query, selector, selector, asserter, entryCount); - protected virtual Task AssertMin( + protected Task AssertMin( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -600,7 +600,7 @@ protected virtual Task AssertMin( where TItem1 : class => Fixture.QueryAsserter.AssertMin(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, entryCount, isAsync); - protected virtual Task AssertMin( + protected Task AssertMin( bool isAsync, Func, IQueryable> query, Expression> selector, @@ -609,7 +609,7 @@ protected virtual Task AssertMin( where TItem1 : class => AssertMin(isAsync, query, query, selector, selector, asserter, entryCount); - protected virtual Task AssertMin( + protected Task AssertMin( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -620,7 +620,7 @@ protected virtual Task AssertMin( where TItem1 : class => Fixture.QueryAsserter.AssertMin(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, entryCount, isAsync); - protected virtual Task AssertMin( + protected Task AssertMin( bool isAsync, Func, IQueryable> query, Expression> selector, @@ -629,7 +629,7 @@ protected virtual Task AssertMin( where TItem1 : class => AssertMin(isAsync, query, query, selector, selector, asserter, entryCount); - protected virtual Task AssertMin( + protected Task AssertMin( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -644,7 +644,7 @@ protected virtual Task AssertMin( #region AssertMax - protected virtual Task AssertMax( + protected Task AssertMax( bool isAsync, Func, IQueryable> query, Action asserter = null, @@ -652,7 +652,7 @@ protected virtual Task AssertMax( where TItem1 : class => AssertMax(isAsync, query, query, asserter, entryCount); - protected virtual Task AssertMax( + protected Task AssertMax( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -661,7 +661,7 @@ protected virtual Task AssertMax( where TItem1 : class => Fixture.QueryAsserter.AssertMax(actualQuery, expectedQuery, asserter, entryCount, isAsync); - protected virtual Task AssertMax( + protected Task AssertMax( bool isAsync, Func, IQueryable> query, Action asserter = null, @@ -669,7 +669,7 @@ protected virtual Task AssertMax( where TItem1 : class => AssertMax(isAsync, query, query, asserter, entryCount); - protected virtual Task AssertMax( + protected Task AssertMax( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -678,7 +678,7 @@ protected virtual Task AssertMax( where TItem1 : class => Fixture.QueryAsserter.AssertMax(actualQuery, expectedQuery, asserter, entryCount, isAsync); - protected virtual Task AssertMax( + protected Task AssertMax( bool isAsync, Func, IQueryable> query, Action asserter = null, @@ -686,7 +686,7 @@ protected virtual Task AssertMax( where TItem1 : class => AssertMax(isAsync, query, query, asserter, entryCount); - protected virtual Task AssertMax( + protected Task AssertMax( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -695,7 +695,7 @@ protected virtual Task AssertMax( where TItem1 : class => Fixture.QueryAsserter.AssertMax(actualQuery, expectedQuery, asserter, entryCount, isAsync); - protected virtual Task AssertMax( + protected Task AssertMax( bool isAsync, Func, IQueryable> query, Expression> selector, @@ -704,7 +704,7 @@ protected virtual Task AssertMax( where TItem1 : class => AssertMax(isAsync, query, query, selector, selector, asserter, entryCount); - protected virtual Task AssertMax( + protected Task AssertMax( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -715,7 +715,7 @@ protected virtual Task AssertMax( where TItem1 : class => Fixture.QueryAsserter.AssertMax(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, entryCount, isAsync); - protected virtual Task AssertMax( + protected Task AssertMax( bool isAsync, Func, IQueryable> query, Expression> selector, @@ -724,7 +724,7 @@ protected virtual Task AssertMax( where TItem1 : class => AssertMax(isAsync, query, query, selector, selector, asserter, entryCount); - protected virtual Task AssertMax( + protected Task AssertMax( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -735,7 +735,7 @@ protected virtual Task AssertMax( where TItem1 : class => Fixture.QueryAsserter.AssertMax(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, entryCount, isAsync); - protected virtual Task AssertMax( + protected Task AssertMax( bool isAsync, Func, IQueryable> query, Expression> selector, @@ -744,7 +744,7 @@ protected virtual Task AssertMax( where TItem1 : class => AssertMax(isAsync, query, query, selector, selector, asserter, entryCount); - protected virtual Task AssertMax( + protected Task AssertMax( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -759,14 +759,14 @@ protected virtual Task AssertMax( #region AssertSum - protected virtual Task AssertSum( + protected Task AssertSum( bool isAsync, Func, IQueryable> query, Action asserter = null) where TItem1 : class => AssertSum(isAsync, query, query, asserter); - protected virtual Task AssertSum( + protected Task AssertSum( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -774,14 +774,14 @@ protected virtual Task AssertSum( where TItem1 : class => Fixture.QueryAsserter.AssertSum(actualQuery, expectedQuery, asserter, isAsync); - protected virtual Task AssertSum( + protected Task AssertSum( bool isAsync, Func, IQueryable> query, Action asserter = null) where TItem1 : class => AssertSum(isAsync, query, query, asserter); - protected virtual Task AssertSum( + protected Task AssertSum( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -789,7 +789,7 @@ protected virtual Task AssertSum( where TItem1 : class => Fixture.QueryAsserter.AssertSum(actualQuery, expectedQuery, asserter, isAsync); - protected virtual Task AssertSum( + protected Task AssertSum( bool isAsync, Func, IQueryable> query, Expression> selector, @@ -797,7 +797,7 @@ protected virtual Task AssertSum( where TItem1 : class => Fixture.QueryAsserter.AssertSum(query, query, selector, selector, asserter, isAsync); - protected virtual Task AssertSum( + protected Task AssertSum( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -807,7 +807,7 @@ protected virtual Task AssertSum( where TItem1 : class => Fixture.QueryAsserter.AssertSum(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, isAsync); - protected virtual Task AssertSum( + protected Task AssertSum( bool isAsync, Func, IQueryable> query, Expression> selector, @@ -815,7 +815,7 @@ protected virtual Task AssertSum( where TItem1 : class => Fixture.QueryAsserter.AssertSum(query, query, selector, selector, asserter, isAsync); - protected virtual Task AssertSum( + protected Task AssertSum( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -825,7 +825,7 @@ protected virtual Task AssertSum( where TItem1 : class => Fixture.QueryAsserter.AssertSum(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, isAsync); - protected virtual Task AssertSum( + protected Task AssertSum( bool isAsync, Func, IQueryable> query, Expression> selector, @@ -833,7 +833,7 @@ protected virtual Task AssertSum( where TItem1 : class => Fixture.QueryAsserter.AssertSum(query, query, selector, selector, asserter, isAsync); - protected virtual Task AssertSum( + protected Task AssertSum( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -843,7 +843,7 @@ protected virtual Task AssertSum( where TItem1 : class => Fixture.QueryAsserter.AssertSum(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, isAsync); - protected virtual Task AssertSum( + protected Task AssertSum( bool isAsync, Func, IQueryable> query, Expression> selector, @@ -851,7 +851,7 @@ protected virtual Task AssertSum( where TItem1 : class => Fixture.QueryAsserter.AssertSum(query, query, selector, selector, asserter, isAsync); - protected virtual Task AssertSum( + protected Task AssertSum( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -861,7 +861,7 @@ protected virtual Task AssertSum( where TItem1 : class => Fixture.QueryAsserter.AssertSum(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, isAsync); - protected virtual Task AssertSum( + protected Task AssertSum( bool isAsync, Func, IQueryable, IQueryable> query, Expression> selector, @@ -870,7 +870,7 @@ protected virtual Task AssertSum( where TItem2 : class => Fixture.QueryAsserter.AssertSum(query, query, selector, selector, asserter, isAsync); - protected virtual Task AssertSum( + protected Task AssertSum( bool isAsync, Func, IQueryable, IQueryable> actualQuery, Func, IQueryable, IQueryable> expectedQuery, @@ -885,14 +885,14 @@ protected virtual Task AssertSum( #region AssertAverage - protected virtual Task AssertAverage( + protected Task AssertAverage( bool isAsync, Func, IQueryable> query, Action asserter = null) where TItem1 : class => AssertAverage(isAsync, query, query); - protected virtual Task AssertAverage( + protected Task AssertAverage( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -900,7 +900,7 @@ protected virtual Task AssertAverage( where TItem1 : class => Fixture.QueryAsserter.AssertAverage(actualQuery, expectedQuery, asserter, isAsync); - protected virtual Task AssertAverage( + protected Task AssertAverage( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -908,14 +908,14 @@ protected virtual Task AssertAverage( where TItem1 : class => Fixture.QueryAsserter.AssertAverage(actualQuery, expectedQuery, asserter, isAsync); - protected virtual Task AssertAverage( + protected Task AssertAverage( bool isAsync, Func, IQueryable> query, Action asserter = null) where TItem1 : class => AssertAverage(isAsync, query, query); - protected virtual Task AssertAverage( + protected Task AssertAverage( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -923,7 +923,7 @@ protected virtual Task AssertAverage( where TItem1 : class => Fixture.QueryAsserter.AssertAverage(actualQuery, expectedQuery, asserter, isAsync); - protected virtual Task AssertAverage( + protected Task AssertAverage( bool isAsync, Func, IQueryable> query, Expression> selector, @@ -931,7 +931,7 @@ protected virtual Task AssertAverage( where TItem1 : class => AssertAverage(isAsync, query, query, selector, selector, asserter); - protected virtual Task AssertAverage( + protected Task AssertAverage( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -941,7 +941,7 @@ protected virtual Task AssertAverage( where TItem1 : class => Fixture.QueryAsserter.AssertAverage(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, isAsync); - protected virtual Task AssertAverage( + protected Task AssertAverage( bool isAsync, Func, IQueryable> query, Expression> selector, @@ -949,7 +949,7 @@ protected virtual Task AssertAverage( where TItem1 : class => AssertAverage(isAsync, query, query, selector, selector, asserter); - protected virtual Task AssertAverage( + protected Task AssertAverage( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -959,7 +959,7 @@ protected virtual Task AssertAverage( where TItem1 : class => Fixture.QueryAsserter.AssertAverage(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, isAsync); - protected virtual Task AssertAverage( + protected Task AssertAverage( bool isAsync, Func, IQueryable> query, Expression> selector, @@ -967,7 +967,7 @@ protected virtual Task AssertAverage( where TItem1 : class => AssertAverage(isAsync, query, query, selector, selector, asserter); - protected virtual Task AssertAverage( + protected Task AssertAverage( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, @@ -977,7 +977,7 @@ protected virtual Task AssertAverage( where TItem1 : class => Fixture.QueryAsserter.AssertAverage(actualQuery, expectedQuery, actualSelector, expectedSelector, asserter, isAsync); - protected virtual Task AssertAverage( + protected Task AssertAverage( bool isAsync, Func, IQueryable> query, Expression> selector, @@ -985,7 +985,7 @@ protected virtual Task AssertAverage( where TItem1 : class => AssertAverage(isAsync, query, query, selector, selector, asserter); - protected virtual Task AssertAverage( + protected Task AssertAverage( bool isAsync, Func, IQueryable> actualQuery, Func, IQueryable> expectedQuery, diff --git a/test/EFCore.Specification.Tests/Query/SimpleQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/SimpleQueryTestBase.cs index 92cb86e93ae..5dc256e65e5 100644 --- a/test/EFCore.Specification.Tests/Query/SimpleQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/SimpleQueryTestBase.cs @@ -6012,5 +6012,14 @@ public virtual Task Convert_to_nullable_on_nullable_value_is_ignored(bool isAsyn isAsync, os => os.Select(o => new Order { OrderDate = o.OrderDate.Value })); } + + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual Task Navigation_inside_interpolated_string_is_expanded(bool isAsync) + { + return AssertQuery( + isAsync, + os => os.Select(o => $"CustomerCity:{o.Customer.City}")); + } } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs index 207bb51481e..d2f9414e2fa 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs @@ -1023,10 +1023,10 @@ public override async Task Null_propagation_optimization2(bool isAsync) await base.Null_propagation_optimization2(isAsync); // issue #16050 -// AssertSql( -// @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOrBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] -//FROM [Gears] AS [g] -//WHERE [g].[Discriminator] IN (N'Officer', N'Gear') AND [g].[LeaderNickname] LIKE N'%us'"); + // AssertSql( + // @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOrBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] + //FROM [Gears] AS [g] + //WHERE [g].[Discriminator] IN (N'Officer', N'Gear') AND [g].[LeaderNickname] LIKE N'%us'"); } public override async Task Null_propagation_optimization3(bool isAsync) @@ -1034,10 +1034,10 @@ public override async Task Null_propagation_optimization3(bool isAsync) await base.Null_propagation_optimization3(isAsync); // issue #16050 -// AssertSql( -// @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOrBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] -//FROM [Gears] AS [g] -//WHERE [g].[Discriminator] IN (N'Officer', N'Gear') AND [g].[LeaderNickname] LIKE N'%us'"); + // AssertSql( + // @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOrBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] + //FROM [Gears] AS [g] + //WHERE [g].[Discriminator] IN (N'Officer', N'Gear') AND [g].[LeaderNickname] LIKE N'%us'"); } public override async Task Null_propagation_optimization4(bool isAsync) @@ -1045,10 +1045,10 @@ public override async Task Null_propagation_optimization4(bool isAsync) await base.Null_propagation_optimization4(isAsync); // issue #16050 -// AssertSql( -// @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOrBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] -//FROM [Gears] AS [g] -//WHERE [g].[Discriminator] IN (N'Officer', N'Gear') AND (CAST(LEN([g].[LeaderNickname]) AS int) = 5)"); + // AssertSql( + // @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOrBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] + //FROM [Gears] AS [g] + //WHERE [g].[Discriminator] IN (N'Officer', N'Gear') AND (CAST(LEN([g].[LeaderNickname]) AS int) = 5)"); } public override async Task Null_propagation_optimization5(bool isAsync) @@ -1056,10 +1056,10 @@ public override async Task Null_propagation_optimization5(bool isAsync) await base.Null_propagation_optimization5(isAsync); // issue #16050 -// AssertSql( -// @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOrBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] -//FROM [Gears] AS [g] -//WHERE [g].[Discriminator] IN (N'Officer', N'Gear') AND (CAST(LEN([g].[LeaderNickname]) AS int) = 5)"); + // AssertSql( + // @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOrBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] + //FROM [Gears] AS [g] + //WHERE [g].[Discriminator] IN (N'Officer', N'Gear') AND (CAST(LEN([g].[LeaderNickname]) AS int) = 5)"); } public override async Task Null_propagation_optimization6(bool isAsync) @@ -1067,10 +1067,10 @@ public override async Task Null_propagation_optimization6(bool isAsync) await base.Null_propagation_optimization6(isAsync); // issue #16050 -// AssertSql( -// @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOrBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] -//FROM [Gears] AS [g] -//WHERE [g].[Discriminator] IN (N'Officer', N'Gear') AND (CAST(LEN([g].[LeaderNickname]) AS int) = 5)"); + // AssertSql( + // @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOrBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] + //FROM [Gears] AS [g] + //WHERE [g].[Discriminator] IN (N'Officer', N'Gear') AND (CAST(LEN([g].[LeaderNickname]) AS int) = 5)"); } public override async Task Select_null_propagation_optimization7(bool isAsync) @@ -1078,10 +1078,10 @@ public override async Task Select_null_propagation_optimization7(bool isAsync) await base.Select_null_propagation_optimization7(isAsync); // issue #16050 -// AssertSql( -// @"SELECT [g].[LeaderNickname] + [g].[LeaderNickname] -//FROM [Gears] AS [g] -//WHERE [g].[Discriminator] IN (N'Officer', N'Gear')"); + // AssertSql( + // @"SELECT [g].[LeaderNickname] + [g].[LeaderNickname] + //FROM [Gears] AS [g] + //WHERE [g].[Discriminator] IN (N'Officer', N'Gear')"); } public override async Task Select_null_propagation_optimization8(bool isAsync) @@ -1125,14 +1125,14 @@ public override async Task Select_null_propagation_negative2(bool isAsync) await base.Select_null_propagation_negative2(isAsync); // issue #16081 -// AssertSql( -// @"SELECT CASE -// WHEN [g1].[LeaderNickname] IS NOT NULL -// THEN [g2].[LeaderNickname] ELSE NULL -//END -//FROM [Gears] AS [g1] -//CROSS JOIN [Gears] AS [g2] -//WHERE [g1].[Discriminator] IN (N'Officer', N'Gear')"); + // AssertSql( + // @"SELECT CASE + // WHEN [g1].[LeaderNickname] IS NOT NULL + // THEN [g2].[LeaderNickname] ELSE NULL + //END + //FROM [Gears] AS [g1] + //CROSS JOIN [Gears] AS [g2] + //WHERE [g1].[Discriminator] IN (N'Officer', N'Gear')"); } public override async Task Select_null_propagation_negative3(bool isAsync) @@ -2081,16 +2081,16 @@ public override async Task Join_with_order_by_without_skip_or_take(bool isAsync) await base.Join_with_order_by_without_skip_or_take(isAsync); // issue #16086 -// AssertSql( -// @"SELECT [t].[Name], [g].[FullName] -//FROM [Gears] AS [g] -//INNER JOIN ( -// SELECT [ww].* -// FROM [Weapons] AS [ww] -// ORDER BY [ww].[Name] -// OFFSET 0 ROWS -//) AS [t] ON [g].[FullName] = [t].[OwnerFullName] -//WHERE [g].[Discriminator] IN (N'Officer', N'Gear')"); + // AssertSql( + // @"SELECT [t].[Name], [g].[FullName] + //FROM [Gears] AS [g] + //INNER JOIN ( + // SELECT [ww].* + // FROM [Weapons] AS [ww] + // ORDER BY [ww].[Name] + // OFFSET 0 ROWS + //) AS [t] ON [g].[FullName] = [t].[OwnerFullName] + //WHERE [g].[Discriminator] IN (N'Officer', N'Gear')"); } public override async Task Collection_with_inheritance_and_join_include_joined(bool isAsync) @@ -3076,10 +3076,10 @@ public override async Task Where_datetimeoffset_date_component(bool isAsync) await base.Where_datetimeoffset_date_component(isAsync); // issue #16057 -// AssertSql( -// @"SELECT [m].[Id], [m].[CodeName], [m].[Rating], [m].[Timeline] -//FROM [Missions] AS [m] -//WHERE CONVERT(date, [m].[Timeline]) > '0001-01-01T00:00:00.0000000-08:00'"); + // AssertSql( + // @"SELECT [m].[Id], [m].[CodeName], [m].[Rating], [m].[Timeline] + //FROM [Missions] AS [m] + //WHERE CONVERT(date, [m].[Timeline]) > '0001-01-01T00:00:00.0000000-08:00'"); } public override async Task Where_datetimeoffset_year_component(bool isAsync) @@ -3450,12 +3450,12 @@ public override void Subquery_is_lifted_from_main_from_clause_of_SelectMany() base.Subquery_is_lifted_from_main_from_clause_of_SelectMany(); // issue #16081 -// AssertSql( -// @"SELECT [g].[FullName] AS [Name1], [g2].[FullName] AS [Name2] -//FROM [Gears] AS [g] -//CROSS JOIN [Gears] AS [g2] -//WHERE [g].[Discriminator] IN (N'Officer', N'Gear') AND (([g].[HasSoulPatch] = CAST(1 AS bit)) AND ([g2].[HasSoulPatch] = CAST(0 AS bit))) -//ORDER BY [Name1], [g].[Rank]"); + // AssertSql( + // @"SELECT [g].[FullName] AS [Name1], [g2].[FullName] AS [Name2] + //FROM [Gears] AS [g] + //CROSS JOIN [Gears] AS [g2] + //WHERE [g].[Discriminator] IN (N'Officer', N'Gear') AND (([g].[HasSoulPatch] = CAST(1 AS bit)) AND ([g2].[HasSoulPatch] = CAST(0 AS bit))) + //ORDER BY [Name1], [g].[Rank]"); } public override async Task Subquery_containing_SelectMany_projecting_main_from_clause_gets_lifted(bool isAsync) @@ -3463,12 +3463,12 @@ public override async Task Subquery_containing_SelectMany_projecting_main_from_c await base.Subquery_containing_SelectMany_projecting_main_from_clause_gets_lifted(isAsync); // issue #16081 -// AssertSql( -// @"SELECT [gear].[FullName] -//FROM [Gears] AS [gear] -//CROSS JOIN [Tags] AS [tag] -//WHERE [gear].[Discriminator] IN (N'Officer', N'Gear') AND ([gear].[HasSoulPatch] = CAST(1 AS bit)) -//ORDER BY [gear].[FullName], [tag].[Note]"); + // AssertSql( + // @"SELECT [gear].[FullName] + //FROM [Gears] AS [gear] + //CROSS JOIN [Tags] AS [tag] + //WHERE [gear].[Discriminator] IN (N'Officer', N'Gear') AND ([gear].[HasSoulPatch] = CAST(1 AS bit)) + //ORDER BY [gear].[FullName], [tag].[Note]"); } public override async Task Subquery_containing_join_projecting_main_from_clause_gets_lifted(bool isAsync) @@ -3528,18 +3528,18 @@ public override async Task Subquery_is_lifted_from_additional_from_clause(bool i await base.Subquery_is_lifted_from_additional_from_clause(isAsync); // issue #16081 -// AssertSql( -// @"SELECT [g1].[FullName] AS [Name1], [t].[FullName] AS [Name2] -//FROM [Gears] AS [g1] -//CROSS JOIN ( -// SELECT [g].* -// FROM [Gears] AS [g] -// WHERE [g].[Discriminator] IN (N'Officer', N'Gear') -// ORDER BY [g].[Rank] -// OFFSET 0 ROWS -//) AS [t] -//WHERE [g1].[Discriminator] IN (N'Officer', N'Gear') AND (([g1].[HasSoulPatch] = CAST(1 AS bit)) AND ([t].[HasSoulPatch] = CAST(0 AS bit))) -//ORDER BY [Name1]"); + // AssertSql( + // @"SELECT [g1].[FullName] AS [Name1], [t].[FullName] AS [Name2] + //FROM [Gears] AS [g1] + //CROSS JOIN ( + // SELECT [g].* + // FROM [Gears] AS [g] + // WHERE [g].[Discriminator] IN (N'Officer', N'Gear') + // ORDER BY [g].[Rank] + // OFFSET 0 ROWS + //) AS [t] + //WHERE [g1].[Discriminator] IN (N'Officer', N'Gear') AND (([g1].[HasSoulPatch] = CAST(1 AS bit)) AND ([t].[HasSoulPatch] = CAST(0 AS bit))) + //ORDER BY [Name1]"); } public override async Task Subquery_with_result_operator_is_not_lifted(bool isAsync) @@ -3841,16 +3841,16 @@ public override void Navigation_access_on_derived_entity_using_cast() base.Navigation_access_on_derived_entity_using_cast(); // issue #15944 -// AssertSql( -// @"SELECT [f].[Name], [t].[ThreatLevel] AS [Threat] -//FROM [ConditionalFactions] AS [f] -//LEFT JOIN ( -// SELECT [f.Commander].* -// FROM [LocustLeaders] AS [f.Commander] -// WHERE [f.Commander].[Discriminator] = N'LocustCommander' -//) AS [t] ON ([f].[Discriminator] = N'LocustHorde') AND ([f].[CommanderName] = [t].[Name]) -//WHERE ([f].[Discriminator] = N'LocustHorde') AND ([f].[Discriminator] = N'LocustHorde') -//ORDER BY [f].[Name]"); + // AssertSql( + // @"SELECT [f].[Name], [t].[ThreatLevel] AS [Threat] + //FROM [ConditionalFactions] AS [f] + //LEFT JOIN ( + // SELECT [f.Commander].* + // FROM [LocustLeaders] AS [f.Commander] + // WHERE [f.Commander].[Discriminator] = N'LocustCommander' + //) AS [t] ON ([f].[Discriminator] = N'LocustHorde') AND ([f].[CommanderName] = [t].[Name]) + //WHERE ([f].[Discriminator] = N'LocustHorde') AND ([f].[Discriminator] = N'LocustHorde') + //ORDER BY [f].[Name]"); } public override void Navigation_access_on_derived_materialized_entity_using_cast() @@ -3858,16 +3858,16 @@ public override void Navigation_access_on_derived_materialized_entity_using_cast base.Navigation_access_on_derived_materialized_entity_using_cast(); // issue #15944 -// AssertSql( -// @"SELECT [f].[Id], [f].[CapitalName], [f].[Discriminator], [f].[Name], [f].[CommanderName], [f].[Eradicated], [t].[ThreatLevel] -//FROM [ConditionalFactions] AS [f] -//LEFT JOIN ( -// SELECT [f.Commander].* -// FROM [LocustLeaders] AS [f.Commander] -// WHERE [f.Commander].[Discriminator] = N'LocustCommander' -//) AS [t] ON ([f].[Discriminator] = N'LocustHorde') AND ([f].[CommanderName] = [t].[Name]) -//WHERE ([f].[Discriminator] = N'LocustHorde') AND ([f].[Discriminator] = N'LocustHorde') -//ORDER BY [f].[Name]"); + // AssertSql( + // @"SELECT [f].[Id], [f].[CapitalName], [f].[Discriminator], [f].[Name], [f].[CommanderName], [f].[Eradicated], [t].[ThreatLevel] + //FROM [ConditionalFactions] AS [f] + //LEFT JOIN ( + // SELECT [f.Commander].* + // FROM [LocustLeaders] AS [f.Commander] + // WHERE [f.Commander].[Discriminator] = N'LocustCommander' + //) AS [t] ON ([f].[Discriminator] = N'LocustHorde') AND ([f].[CommanderName] = [t].[Name]) + //WHERE ([f].[Discriminator] = N'LocustHorde') AND ([f].[Discriminator] = N'LocustHorde') + //ORDER BY [f].[Name]"); } public override void Navigation_access_via_EFProperty_on_derived_entity_using_cast() @@ -3890,16 +3890,16 @@ public override void Navigation_access_fk_on_derived_entity_using_cast() { base.Navigation_access_fk_on_derived_entity_using_cast(); -// AssertSql( -// @"SELECT [f].[Name] AS [Name0], [t].[Name] AS [CommanderName] -//FROM [ConditionalFactions] AS [f] -//LEFT JOIN ( -// SELECT [f.Commander].* -// FROM [LocustLeaders] AS [f.Commander] -// WHERE [f.Commander].[Discriminator] = N'LocustCommander' -//) AS [t] ON ([f].[Discriminator] = N'LocustHorde') AND ([f].[CommanderName] = [t].[Name]) -//WHERE ([f].[Discriminator] = N'LocustHorde') AND ([f].[Discriminator] = N'LocustHorde') -//ORDER BY [Name0]"); + // AssertSql( + // @"SELECT [f].[Name] AS [Name0], [t].[Name] AS [CommanderName] + //FROM [ConditionalFactions] AS [f] + //LEFT JOIN ( + // SELECT [f.Commander].* + // FROM [LocustLeaders] AS [f.Commander] + // WHERE [f.Commander].[Discriminator] = N'LocustCommander' + //) AS [t] ON ([f].[Discriminator] = N'LocustHorde') AND ([f].[CommanderName] = [t].[Name]) + //WHERE ([f].[Discriminator] = N'LocustHorde') AND ([f].[Discriminator] = N'LocustHorde') + //ORDER BY [Name0]"); } public override void Collection_navigation_access_on_derived_entity_using_cast() @@ -3922,12 +3922,12 @@ public override void Collection_navigation_access_on_derived_entity_using_cast_i base.Collection_navigation_access_on_derived_entity_using_cast_in_SelectMany(); // TODO: this will later be translated to INNER JOIN -// AssertSql( -// @"SELECT [f].[Name] AS [Name0], [f.Leaders].[Name] AS [LeaderName] -//FROM [ConditionalFactions] AS [f] -//INNER JOIN [LocustLeaders] AS [f.Leaders] ON [f].[Id] = [f.Leaders].[LocustHordeId] -//WHERE (([f].[Discriminator] = N'LocustHorde') AND ([f].[Discriminator] = N'LocustHorde')) AND [f.Leaders].[Discriminator] IN (N'LocustCommander', N'LocustLeader') -//ORDER BY [LeaderName]"); + // AssertSql( + // @"SELECT [f].[Name] AS [Name0], [f.Leaders].[Name] AS [LeaderName] + //FROM [ConditionalFactions] AS [f] + //INNER JOIN [LocustLeaders] AS [f.Leaders] ON [f].[Id] = [f.Leaders].[LocustHordeId] + //WHERE (([f].[Discriminator] = N'LocustHorde') AND ([f].[Discriminator] = N'LocustHorde')) AND [f.Leaders].[Discriminator] IN (N'LocustCommander', N'LocustLeader') + //ORDER BY [LeaderName]"); AssertSql( @"SELECT [f].[Name] AS [Name0], [ll].[Name] AS [LeaderName] @@ -4152,10 +4152,10 @@ public override void Select_null_conditional_with_inheritance() { base.Select_null_conditional_with_inheritance(); -// AssertSql( -// @"SELECT [f].[CommanderName] -//FROM [ConditionalFactions] AS [f] -//WHERE ([f].[Discriminator] = N'LocustHorde') AND ([f].[Discriminator] = N'LocustHorde')"); + // AssertSql( + // @"SELECT [f].[CommanderName] + //FROM [ConditionalFactions] AS [f] + //WHERE ([f].[Discriminator] = N'LocustHorde') AND ([f].[Discriminator] = N'LocustHorde')"); } public override void Select_null_conditional_with_inheritance_negative() @@ -5869,11 +5869,11 @@ public override async Task Select_required_navigation_on_derived_type(bool isAsy { await base.Select_required_navigation_on_derived_type(isAsync); -// AssertSql( -// @"SELECT [ll.HighCommand].[Name] -//FROM [LocustLeaders] AS [ll] -//LEFT JOIN [LocustHighCommands] AS [ll.HighCommand] ON ([ll].[Discriminator] = N'LocustCommander') AND ([ll].[HighCommandId] = [ll.HighCommand].[Id]) -//WHERE [ll].[Discriminator] IN (N'LocustCommander', N'LocustLeader')"); + // AssertSql( + // @"SELECT [ll.HighCommand].[Name] + //FROM [LocustLeaders] AS [ll] + //LEFT JOIN [LocustHighCommands] AS [ll.HighCommand] ON ([ll].[Discriminator] = N'LocustCommander') AND ([ll].[HighCommandId] = [ll.HighCommand].[Id]) + //WHERE [ll].[Discriminator] IN (N'LocustCommander', N'LocustLeader')"); } public override async Task Select_required_navigation_on_the_same_type_with_cast(bool isAsync) @@ -5891,11 +5891,11 @@ public override async Task Where_required_navigation_on_derived_type(bool isAsyn { await base.Where_required_navigation_on_derived_type(isAsync); -// AssertSql( -// @"SELECT [ll].[Name], [ll].[Discriminator], [ll].[LocustHordeId], [ll].[ThreatLevel], [ll].[DefeatedByNickname], [ll].[DefeatedBySquadId], [ll].[HighCommandId] -//FROM [LocustLeaders] AS [ll] -//LEFT JOIN [LocustHighCommands] AS [ll.HighCommand] ON ([ll].[Discriminator] = N'LocustCommander') AND ([ll].[HighCommandId] = [ll.HighCommand].[Id]) -//WHERE [ll].[Discriminator] IN (N'LocustCommander', N'LocustLeader') AND ([ll.HighCommand].[IsOperational] = CAST(1 AS bit))"); + // AssertSql( + // @"SELECT [ll].[Name], [ll].[Discriminator], [ll].[LocustHordeId], [ll].[ThreatLevel], [ll].[DefeatedByNickname], [ll].[DefeatedBySquadId], [ll].[HighCommandId] + //FROM [LocustLeaders] AS [ll] + //LEFT JOIN [LocustHighCommands] AS [ll.HighCommand] ON ([ll].[Discriminator] = N'LocustCommander') AND ([ll].[HighCommandId] = [ll.HighCommand].[Id]) + //WHERE [ll].[Discriminator] IN (N'LocustCommander', N'LocustLeader') AND ([ll.HighCommand].[IsOperational] = CAST(1 AS bit))"); } public override async Task Outer_parameter_in_join_key(bool isAsync) @@ -6078,12 +6078,12 @@ FROM [LocustLeaders] AS [lc] INNER JOIN [LocustHighCommands] AS [lc.HighCommand] ON [lc].[HighCommandId] = [lc.HighCommand].[Id] WHERE [lc].[Discriminator] = N'LocustCommander' ORDER BY [lc.HighCommand].[Id], [lc].[Name]"); -// AssertSql( -// @"SELECT [lc].[Name] -//FROM [LocustLeaders] AS [lc] -//INNER JOIN [LocustHighCommands] AS [lc.HighCommand] ON [lc].[HighCommandId] = [lc.HighCommand].[Id] -//WHERE [lc].[Discriminator] = N'LocustCommander' -//ORDER BY [lc.HighCommand].[Id], [lc].[Name]"); + // AssertSql( + // @"SELECT [lc].[Name] + //FROM [LocustLeaders] AS [lc] + //INNER JOIN [LocustHighCommands] AS [lc.HighCommand] ON [lc].[HighCommandId] = [lc.HighCommand].[Id] + //WHERE [lc].[Discriminator] = N'LocustCommander' + //ORDER BY [lc.HighCommand].[Id], [lc].[Name]"); } public override async Task Order_by_entity_qsre_composite_key(bool isAsync) @@ -6132,11 +6132,11 @@ public override async Task Join_on_entity_qsre_keys_composite_key(bool isAsync) await base.Join_on_entity_qsre_keys_composite_key(isAsync); // issue #16081 -// AssertSql( -// @"SELECT [g1].[FullName] AS [GearName1], [g2].[FullName] AS [GearName2] -//FROM [Gears] AS [g1] -//INNER JOIN [Gears] AS [g2] ON ([g1].[Nickname] = [g2].[Nickname]) AND ([g1].[SquadId] = [g2].[SquadId]) -//WHERE [g1].[Discriminator] IN (N'Officer', N'Gear') AND [g2].[Discriminator] IN (N'Officer', N'Gear')"); + // AssertSql( + // @"SELECT [g1].[FullName] AS [GearName1], [g2].[FullName] AS [GearName2] + //FROM [Gears] AS [g1] + //INNER JOIN [Gears] AS [g2] ON ([g1].[Nickname] = [g2].[Nickname]) AND ([g1].[SquadId] = [g2].[SquadId]) + //WHERE [g1].[Discriminator] IN (N'Officer', N'Gear') AND [g2].[Discriminator] IN (N'Officer', N'Gear')"); } public override async Task Join_on_entity_qsre_keys_inheritance(bool isAsync) @@ -6144,11 +6144,11 @@ public override async Task Join_on_entity_qsre_keys_inheritance(bool isAsync) await base.Join_on_entity_qsre_keys_inheritance(isAsync); // issue #16081 -// AssertSql( -// @"SELECT [g].[FullName] AS [GearName], [o].[FullName] AS [OfficerName] -//FROM [Gears] AS [g] -//INNER JOIN [Gears] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) -//WHERE [g].[Discriminator] IN (N'Officer', N'Gear') AND ([o].[Discriminator] = N'Officer')"); + // AssertSql( + // @"SELECT [g].[FullName] AS [GearName], [o].[FullName] AS [OfficerName] + //FROM [Gears] AS [g] + //INNER JOIN [Gears] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) + //WHERE [g].[Discriminator] IN (N'Officer', N'Gear') AND ([o].[Discriminator] = N'Officer')"); } public override async Task Join_on_entity_qsre_keys_outer_key_is_navigation(bool isAsync) @@ -6402,14 +6402,14 @@ public override async Task Project_one_value_type_from_empty_collection(bool isA await base.Project_one_value_type_from_empty_collection(isAsync); // issue #15864 -// AssertSql( -// @"SELECT [s].[Name], COALESCE(( -// SELECT TOP(1) [g].[SquadId] -// FROM [Gears] AS [g] -// WHERE ([g].[Discriminator] IN (N'Officer', N'Gear') AND ([s].[Id] = [g].[SquadId])) AND ([g].[HasSoulPatch] = CAST(1 AS bit)) -//), 0) AS [SquadId] -//FROM [Squads] AS [s] -//WHERE [s].[Name] = N'Kilo'"); + // AssertSql( + // @"SELECT [s].[Name], COALESCE(( + // SELECT TOP(1) [g].[SquadId] + // FROM [Gears] AS [g] + // WHERE ([g].[Discriminator] IN (N'Officer', N'Gear') AND ([s].[Id] = [g].[SquadId])) AND ([g].[HasSoulPatch] = CAST(1 AS bit)) + //), 0) AS [SquadId] + //FROM [Squads] AS [s] + //WHERE [s].[Name] = N'Kilo'"); } public override async Task Filter_on_subquery_projecting_one_value_type_from_empty_collection(bool isAsync) @@ -6431,13 +6431,13 @@ public override async Task Select_subquery_projecting_single_constant_int(bool i await base.Select_subquery_projecting_single_constant_int(isAsync); // issue #15864 -// AssertSql( -// @"SELECT [s].[Name], COALESCE(( -// SELECT TOP(1) 42 -// FROM [Gears] AS [g] -// WHERE ([g].[Discriminator] IN (N'Officer', N'Gear') AND ([s].[Id] = [g].[SquadId])) AND ([g].[HasSoulPatch] = CAST(1 AS bit)) -//), 0) AS [Gear] -//FROM [Squads] AS [s]"); + // AssertSql( + // @"SELECT [s].[Name], COALESCE(( + // SELECT TOP(1) 42 + // FROM [Gears] AS [g] + // WHERE ([g].[Discriminator] IN (N'Officer', N'Gear') AND ([s].[Id] = [g].[SquadId])) AND ([g].[HasSoulPatch] = CAST(1 AS bit)) + //), 0) AS [Gear] + //FROM [Squads] AS [s]"); } public override async Task Select_subquery_projecting_single_constant_string(bool isAsync) @@ -6457,13 +6457,13 @@ public override async Task Select_subquery_projecting_single_constant_bool(bool await base.Select_subquery_projecting_single_constant_bool(isAsync); // issue #15864 -// AssertSql( -// @"SELECT [s].[Name], COALESCE(( -// SELECT TOP(1) CAST(1 AS bit) -// FROM [Gears] AS [g] -// WHERE ([g].[Discriminator] IN (N'Officer', N'Gear') AND ([s].[Id] = [g].[SquadId])) AND ([g].[HasSoulPatch] = CAST(1 AS bit)) -//), CAST(0 AS bit)) AS [Gear] -//FROM [Squads] AS [s]"); + // AssertSql( + // @"SELECT [s].[Name], COALESCE(( + // SELECT TOP(1) CAST(1 AS bit) + // FROM [Gears] AS [g] + // WHERE ([g].[Discriminator] IN (N'Officer', N'Gear') AND ([s].[Id] = [g].[SquadId])) AND ([g].[HasSoulPatch] = CAST(1 AS bit)) + //), CAST(0 AS bit)) AS [Gear] + //FROM [Squads] AS [s]"); } public override async Task Select_subquery_projecting_single_constant_inside_anonymous(bool isAsync) @@ -6790,15 +6790,15 @@ public override async Task Select_subquery_boolean(bool isAsync) await base.Select_subquery_boolean(isAsync); // issue #15864 -// AssertSql( -// @"SELECT COALESCE(( -// SELECT TOP(1) [w].[IsAutomatic] -// FROM [Weapons] AS [w] -// WHERE [g].[FullName] = [w].[OwnerFullName] -// ORDER BY [w].[Id] -//), CAST(0 AS bit)) -//FROM [Gears] AS [g] -//WHERE [g].[Discriminator] IN (N'Officer', N'Gear')"); + // AssertSql( + // @"SELECT COALESCE(( + // SELECT TOP(1) [w].[IsAutomatic] + // FROM [Weapons] AS [w] + // WHERE [g].[FullName] = [w].[OwnerFullName] + // ORDER BY [w].[Id] + //), CAST(0 AS bit)) + //FROM [Gears] AS [g] + //WHERE [g].[Discriminator] IN (N'Officer', N'Gear')"); } public override async Task Select_subquery_boolean_with_pushdown(bool isAsync) @@ -6880,15 +6880,15 @@ public override async Task Select_subquery_boolean_empty(bool isAsync) await base.Select_subquery_boolean_empty(isAsync); // issue #15864 -// AssertSql( -// @"SELECT COALESCE(( -// SELECT TOP(1) [w].[IsAutomatic] -// FROM [Weapons] AS [w] -// WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] = N'BFG') -// ORDER BY [w].[Id] -//), CAST(0 AS bit)) -//FROM [Gears] AS [g] -//WHERE [g].[Discriminator] IN (N'Officer', N'Gear')"); + // AssertSql( + // @"SELECT COALESCE(( + // SELECT TOP(1) [w].[IsAutomatic] + // FROM [Weapons] AS [w] + // WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] = N'BFG') + // ORDER BY [w].[Id] + //), CAST(0 AS bit)) + //FROM [Gears] AS [g] + //WHERE [g].[Discriminator] IN (N'Officer', N'Gear')"); } public override async Task Select_subquery_boolean_empty_with_pushdown(bool isAsync) @@ -7162,13 +7162,13 @@ public override async Task Double_order_by_on_string_compare(bool isAsync) await base.Double_order_by_on_string_compare(isAsync); // issue #16092 -// AssertSql( -// @"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] -//FROM [Weapons] AS [w] -//ORDER BY CASE -// WHEN [w].[Name] = N'Marcus'' Lancer' -// THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -//END, [w].[Id]"); + // AssertSql( + // @"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + //FROM [Weapons] AS [w] + //ORDER BY CASE + // WHEN [w].[Name] = N'Marcus'' Lancer' + // THEN CAST(1 AS bit) ELSE CAST(0 AS bit) + //END, [w].[Id]"); } public override async Task Double_order_by_binary_expression(bool isAsync) @@ -7186,14 +7186,14 @@ public override async Task String_compare_with_null_conditional_argument(bool is await base.String_compare_with_null_conditional_argument(isAsync); // issue #16092 -// AssertSql( -// @"SELECT [w.SynergyWith].[Id], [w.SynergyWith].[AmmunitionType], [w.SynergyWith].[IsAutomatic], [w.SynergyWith].[Name], [w.SynergyWith].[OwnerFullName], [w.SynergyWith].[SynergyWithId] -//FROM [Weapons] AS [w] -//LEFT JOIN [Weapons] AS [w.SynergyWith] ON [w].[SynergyWithId] = [w.SynergyWith].[Id] -//ORDER BY CASE -// WHEN [w.SynergyWith].[Name] = N'Marcus'' Lancer' -// THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -//END"); + // AssertSql( + // @"SELECT [w.SynergyWith].[Id], [w.SynergyWith].[AmmunitionType], [w.SynergyWith].[IsAutomatic], [w.SynergyWith].[Name], [w.SynergyWith].[OwnerFullName], [w.SynergyWith].[SynergyWithId] + //FROM [Weapons] AS [w] + //LEFT JOIN [Weapons] AS [w.SynergyWith] ON [w].[SynergyWithId] = [w.SynergyWith].[Id] + //ORDER BY CASE + // WHEN [w.SynergyWith].[Name] = N'Marcus'' Lancer' + // THEN CAST(1 AS bit) ELSE CAST(0 AS bit) + //END"); } public override async Task String_compare_with_null_conditional_argument2(bool isAsync) @@ -7201,14 +7201,14 @@ public override async Task String_compare_with_null_conditional_argument2(bool i await base.String_compare_with_null_conditional_argument2(isAsync); // issue #16092 -// AssertSql( -// @"SELECT [w.SynergyWith].[Id], [w.SynergyWith].[AmmunitionType], [w.SynergyWith].[IsAutomatic], [w.SynergyWith].[Name], [w.SynergyWith].[OwnerFullName], [w.SynergyWith].[SynergyWithId] -//FROM [Weapons] AS [w] -//LEFT JOIN [Weapons] AS [w.SynergyWith] ON [w].[SynergyWithId] = [w.SynergyWith].[Id] -//ORDER BY CASE -// WHEN N'Marcus'' Lancer' = [w.SynergyWith].[Name] -// THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -//END"); + // AssertSql( + // @"SELECT [w.SynergyWith].[Id], [w.SynergyWith].[AmmunitionType], [w.SynergyWith].[IsAutomatic], [w.SynergyWith].[Name], [w.SynergyWith].[OwnerFullName], [w.SynergyWith].[SynergyWithId] + //FROM [Weapons] AS [w] + //LEFT JOIN [Weapons] AS [w.SynergyWith] ON [w].[SynergyWithId] = [w.SynergyWith].[Id] + //ORDER BY CASE + // WHEN N'Marcus'' Lancer' = [w.SynergyWith].[Name] + // THEN CAST(1 AS bit) ELSE CAST(0 AS bit) + //END"); } public override async Task String_concat_with_null_conditional_argument(bool isAsync) @@ -7600,12 +7600,12 @@ public override void OfTypeNav1() base.OfTypeNav1(); // issue #16094 -// AssertSql( -// @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOrBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] -//FROM [Gears] AS [g] -//LEFT JOIN [Tags] AS [g.Tag] ON ([g].[Nickname] = [g.Tag].[GearNickName]) AND ([g].[SquadId] = [g.Tag].[GearSquadId]) -//LEFT JOIN [Tags] AS [o.Tag] ON ([g].[Nickname] = [o.Tag].[GearNickName]) AND ([g].[SquadId] = [o.Tag].[GearSquadId]) -//WHERE (([g].[Discriminator] = N'Officer') AND (([g.Tag].[Note] <> N'Foo') OR [g.Tag].[Note] IS NULL)) AND (([o.Tag].[Note] <> N'Bar') OR [o.Tag].[Note] IS NULL)"); + // AssertSql( + // @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOrBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] + //FROM [Gears] AS [g] + //LEFT JOIN [Tags] AS [g.Tag] ON ([g].[Nickname] = [g.Tag].[GearNickName]) AND ([g].[SquadId] = [g.Tag].[GearSquadId]) + //LEFT JOIN [Tags] AS [o.Tag] ON ([g].[Nickname] = [o.Tag].[GearNickName]) AND ([g].[SquadId] = [o.Tag].[GearSquadId]) + //WHERE (([g].[Discriminator] = N'Officer') AND (([g.Tag].[Note] <> N'Foo') OR [g.Tag].[Note] IS NULL)) AND (([o.Tag].[Note] <> N'Bar') OR [o.Tag].[Note] IS NULL)"); } public override void OfTypeNav2() @@ -7613,12 +7613,12 @@ public override void OfTypeNav2() base.OfTypeNav2(); // issue #16094 -// AssertSql( -// @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOrBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] -//FROM [Gears] AS [g] -//LEFT JOIN [Tags] AS [g.Tag] ON ([g].[Nickname] = [g.Tag].[GearNickName]) AND ([g].[SquadId] = [g.Tag].[GearSquadId]) -//LEFT JOIN [Cities] AS [o.AssignedCity] ON [g].[AssignedCityName] = [o.AssignedCity].[Name] -//WHERE (([g].[Discriminator] = N'Officer') AND (([g.Tag].[Note] <> N'Foo') OR [g.Tag].[Note] IS NULL)) AND (([o.AssignedCity].[Location] <> 'Bar') OR [o.AssignedCity].[Location] IS NULL)"); + // AssertSql( + // @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOrBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] + //FROM [Gears] AS [g] + //LEFT JOIN [Tags] AS [g.Tag] ON ([g].[Nickname] = [g.Tag].[GearNickName]) AND ([g].[SquadId] = [g.Tag].[GearSquadId]) + //LEFT JOIN [Cities] AS [o.AssignedCity] ON [g].[AssignedCityName] = [o.AssignedCity].[Name] + //WHERE (([g].[Discriminator] = N'Officer') AND (([g.Tag].[Note] <> N'Foo') OR [g.Tag].[Note] IS NULL)) AND (([o.AssignedCity].[Location] <> 'Bar') OR [o.AssignedCity].[Location] IS NULL)"); } public override void OfTypeNav3() @@ -7626,13 +7626,13 @@ public override void OfTypeNav3() base.OfTypeNav3(); // issue #16094 -// AssertSql( -// @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOrBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] -//FROM [Gears] AS [g] -//LEFT JOIN [Tags] AS [g.Tag] ON ([g].[Nickname] = [g.Tag].[GearNickName]) AND ([g].[SquadId] = [g.Tag].[GearSquadId]) -//INNER JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] -//LEFT JOIN [Tags] AS [o.Tag] ON ([g].[Nickname] = [o.Tag].[GearNickName]) AND ([g].[SquadId] = [o.Tag].[GearSquadId]) -//WHERE (([g].[Discriminator] = N'Officer') AND (([g.Tag].[Note] <> N'Foo') OR [g.Tag].[Note] IS NULL)) AND (([o.Tag].[Note] <> N'Bar') OR [o.Tag].[Note] IS NULL)"); + // AssertSql( + // @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOrBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] + //FROM [Gears] AS [g] + //LEFT JOIN [Tags] AS [g.Tag] ON ([g].[Nickname] = [g.Tag].[GearNickName]) AND ([g].[SquadId] = [g.Tag].[GearSquadId]) + //INNER JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] + //LEFT JOIN [Tags] AS [o.Tag] ON ([g].[Nickname] = [o.Tag].[GearNickName]) AND ([g].[SquadId] = [o.Tag].[GearSquadId]) + //WHERE (([g].[Discriminator] = N'Officer') AND (([g.Tag].[Note] <> N'Foo') OR [g.Tag].[Note] IS NULL)) AND (([o.Tag].[Note] <> N'Bar') OR [o.Tag].[Note] IS NULL)"); } public override void Nav_rewrite_Distinct_with_convert() @@ -7656,16 +7656,16 @@ public override void Nav_rewrite_with_convert1() base.Nav_rewrite_with_convert1(); // issue #15994 -// AssertSql( -// @"SELECT [t].[Name], [t].[Discriminator], [t].[LocustHordeId], [t].[ThreatLevel], [t].[DefeatedByNickname], [t].[DefeatedBySquadId], [t].[HighCommandId] -//FROM [ConditionalFactions] AS [f] -//LEFT JOIN [Cities] AS [f.Capital] ON [f].[CapitalName] = [f.Capital].[Name] -//LEFT JOIN ( -// SELECT [f.Capital.Commander].* -// FROM [LocustLeaders] AS [f.Capital.Commander] -// WHERE [f.Capital.Commander].[Discriminator] = N'LocustCommander' -//) AS [t] ON ([f].[Discriminator] = N'LocustHorde') AND ([f].[CommanderName] = [t].[Name]) -//WHERE ([f].[Discriminator] = N'LocustHorde') AND (([f.Capital].[Name] <> N'Foo') OR [f.Capital].[Name] IS NULL)"); + // AssertSql( + // @"SELECT [t].[Name], [t].[Discriminator], [t].[LocustHordeId], [t].[ThreatLevel], [t].[DefeatedByNickname], [t].[DefeatedBySquadId], [t].[HighCommandId] + //FROM [ConditionalFactions] AS [f] + //LEFT JOIN [Cities] AS [f.Capital] ON [f].[CapitalName] = [f.Capital].[Name] + //LEFT JOIN ( + // SELECT [f.Capital.Commander].* + // FROM [LocustLeaders] AS [f.Capital.Commander] + // WHERE [f.Capital.Commander].[Discriminator] = N'LocustCommander' + //) AS [t] ON ([f].[Discriminator] = N'LocustHorde') AND ([f].[CommanderName] = [t].[Name]) + //WHERE ([f].[Discriminator] = N'LocustHorde') AND (([f.Capital].[Name] <> N'Foo') OR [f.Capital].[Name] IS NULL)"); } public override void Nav_rewrite_with_convert2() @@ -7673,16 +7673,16 @@ public override void Nav_rewrite_with_convert2() base.Nav_rewrite_with_convert2(); // issue #15994 -// AssertSql( -// @"SELECT [f].[Id], [f].[CapitalName], [f].[Discriminator], [f].[Name], [f].[CommanderName], [f].[Eradicated] -//FROM [ConditionalFactions] AS [f] -//LEFT JOIN [Cities] AS [f.Capital] ON [f].[CapitalName] = [f.Capital].[Name] -//LEFT JOIN ( -// SELECT [f.Capital.Commander].* -// FROM [LocustLeaders] AS [f.Capital.Commander] -// WHERE [f.Capital.Commander].[Discriminator] = N'LocustCommander' -//) AS [t] ON ([f].[Discriminator] = N'LocustHorde') AND ([f].[CommanderName] = [t].[Name]) -//WHERE (([f].[Discriminator] = N'LocustHorde') AND (([f.Capital].[Name] <> N'Foo') OR [f.Capital].[Name] IS NULL)) AND (([t].[Name] <> N'Bar') OR [t].[Name] IS NULL)"); + // AssertSql( + // @"SELECT [f].[Id], [f].[CapitalName], [f].[Discriminator], [f].[Name], [f].[CommanderName], [f].[Eradicated] + //FROM [ConditionalFactions] AS [f] + //LEFT JOIN [Cities] AS [f.Capital] ON [f].[CapitalName] = [f.Capital].[Name] + //LEFT JOIN ( + // SELECT [f.Capital.Commander].* + // FROM [LocustLeaders] AS [f.Capital.Commander] + // WHERE [f.Capital.Commander].[Discriminator] = N'LocustCommander' + //) AS [t] ON ([f].[Discriminator] = N'LocustHorde') AND ([f].[CommanderName] = [t].[Name]) + //WHERE (([f].[Discriminator] = N'LocustHorde') AND (([f.Capital].[Name] <> N'Foo') OR [f.Capital].[Name] IS NULL)) AND (([t].[Name] <> N'Bar') OR [t].[Name] IS NULL)"); } public override void Nav_rewrite_with_convert3() @@ -7690,16 +7690,16 @@ public override void Nav_rewrite_with_convert3() base.Nav_rewrite_with_convert3(); // issue #15994 -// AssertSql( -// @"SELECT [f].[Id], [f].[CapitalName], [f].[Discriminator], [f].[Name], [f].[CommanderName], [f].[Eradicated] -//FROM [ConditionalFactions] AS [f] -//LEFT JOIN [Cities] AS [f.Capital] ON [f].[CapitalName] = [f.Capital].[Name] -//LEFT JOIN ( -// SELECT [f.Capital.Commander].* -// FROM [LocustLeaders] AS [f.Capital.Commander] -// WHERE [f.Capital.Commander].[Discriminator] = N'LocustCommander' -//) AS [t] ON ([f].[Discriminator] = N'LocustHorde') AND ([f].[CommanderName] = [t].[Name]) -//WHERE (([f].[Discriminator] = N'LocustHorde') AND (([f.Capital].[Name] <> N'Foo') OR [f.Capital].[Name] IS NULL)) AND (([t].[Name] <> N'Bar') OR [t].[Name] IS NULL)"); + // AssertSql( + // @"SELECT [f].[Id], [f].[CapitalName], [f].[Discriminator], [f].[Name], [f].[CommanderName], [f].[Eradicated] + //FROM [ConditionalFactions] AS [f] + //LEFT JOIN [Cities] AS [f.Capital] ON [f].[CapitalName] = [f.Capital].[Name] + //LEFT JOIN ( + // SELECT [f.Capital.Commander].* + // FROM [LocustLeaders] AS [f.Capital.Commander] + // WHERE [f.Capital.Commander].[Discriminator] = N'LocustCommander' + //) AS [t] ON ([f].[Discriminator] = N'LocustHorde') AND ([f].[CommanderName] = [t].[Name]) + //WHERE (([f].[Discriminator] = N'LocustHorde') AND (([f.Capital].[Name] <> N'Foo') OR [f.Capital].[Name] IS NULL)) AND (([t].[Name] <> N'Bar') OR [t].[Name] IS NULL)"); } public override async Task Where_contains_on_navigation_with_composite_keys(bool isAsync) @@ -7765,7 +7765,21 @@ public override async Task DateTimeOffset_Contains_Less_than_Greater_than(bool i SELECT [m].[Id], [m].[CodeName], [m].[Rating], [m].[Timeline] FROM [Missions] AS [m] -WHERE ((@__start_0 <= CAST(CONVERT(date, [m].[Timeline]) AS datetimeoffset)) AND ([m].[Timeline] < @__end_1)) AND [m].[Timeline] IN ('1902-01-02T10:00:00.1234567+01:30')"); } +WHERE ((@__start_0 <= CAST(CONVERT(date, [m].[Timeline]) AS datetimeoffset)) AND ([m].[Timeline] < @__end_1)) AND [m].[Timeline] IN ('1902-01-02T10:00:00.1234567+01:30')"); + } + + public override async Task Navigation_inside_interpolated_string_expanded(bool isAsync) + { + await base.Navigation_inside_interpolated_string_expanded(isAsync); + + AssertSql( + @"SELECT CASE + WHEN [w].[SynergyWithId] IS NOT NULL THEN CAST(1 AS bit) + ELSE CAST(0 AS bit) +END, [w0].[OwnerFullName] +FROM [Weapons] AS [w] +LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id]"); + } private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/SimpleQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/SimpleQuerySqlServerTest.cs index cc3cddd5efd..3febfbc98d3 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/SimpleQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/SimpleQuerySqlServerTest.cs @@ -4899,6 +4899,16 @@ public override async Task Convert_to_nullable_on_nullable_value_is_ignored(bool FROM [Orders] AS [o]"); } + public override async Task Navigation_inside_interpolated_string_is_expanded(bool isAsync) + { + await base.Navigation_inside_interpolated_string_is_expanded(isAsync); + + AssertSql( + @"SELECT [c].[City] +FROM [Orders] AS [o] +LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID]"); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected);