-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: Make QueryAsserter a combined form of TestBase & Fixture confi…
…guration - Introduce methods to rewrite server/expected queries on QueryTestBase - Introduce QueryTestBase.IgnoreEntryCount to run same query with tracking/no tracking via rewritten form - Introduce some relational test bases to verify execution of DbCommands - Merge include asserter into query asserter - Remove Include*Fixtures
- Loading branch information
Showing
93 changed files
with
1,183 additions
and
1,574 deletions.
There are no files selected for viewing
13 changes: 0 additions & 13 deletions
13
test/EFCore.InMemory.FunctionalTests/Query/IncludeInMemoryFixture.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
test/EFCore.Relational.Specification.Tests/Query/AsyncGearsOfWarQueryRelationalTestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class AsyncGearsOfWarQueryRelationalTestBase<TFixture> : AsyncGearsOfWarQueryTestBase<TFixture> | ||
where TFixture : GearsOfWarQueryFixtureBase, new() | ||
{ | ||
protected AsyncGearsOfWarQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
protected virtual bool CanExecuteQueryString => false; | ||
|
||
protected override QueryAsserter CreateQueryAsserter(TFixture fixture) | ||
=> new RelationalQueryAsserter(fixture, RewriteExpectedQueryExpression, RewriteServerQueryExpression, canExecuteQueryString: CanExecuteQueryString); | ||
} | ||
} |
16 changes: 1 addition & 15 deletions
16
...Core.Relational.Specification.Tests/Query/ComplexNavigationsQueryRelationalFixtureBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,12 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.EntityFrameworkCore.TestModels.ComplexNavigationsModel; | ||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class ComplexNavigationsQueryRelationalFixtureBase : ComplexNavigationsQueryFixtureBase | ||
{ | ||
public TestSqlLoggerFactory TestSqlLoggerFactory => (TestSqlLoggerFactory)ListLoggerFactory; | ||
|
||
protected override QueryAsserter<ComplexNavigationsContext> CreateQueryAsserter( | ||
Dictionary<Type, object> entitySorters, | ||
Dictionary<Type, object> entityAsserters) | ||
=> new RelationalQueryAsserter<ComplexNavigationsContext>( | ||
CreateContext, | ||
new ComplexNavigationsDefaultData(), | ||
entitySorters, | ||
entityAsserters, | ||
CanExecuteQueryString, | ||
CreateExpectedQueryRewritingVisitor()); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
.../EFCore.Relational.Specification.Tests/Query/ComplexNavigationsQueryRelationalTestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class ComplexNavigationsQueryRelationalTestBase<TFixture> : ComplexNavigationsQueryTestBase<TFixture> | ||
where TFixture : ComplexNavigationsQueryFixtureBase, new() | ||
{ | ||
protected ComplexNavigationsQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
protected virtual bool CanExecuteQueryString => false; | ||
|
||
protected override QueryAsserter CreateQueryAsserter(TFixture fixture) | ||
=> new RelationalQueryAsserter(fixture, RewriteExpectedQueryExpression, RewriteServerQueryExpression, canExecuteQueryString: CanExecuteQueryString); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
test/EFCore.Relational.Specification.Tests/Query/GearsOfWarQueryRelationalTestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class GearsOfWarQueryRelationalTestBase<TFixture> : GearsOfWarQueryTestBase<TFixture> | ||
where TFixture : GearsOfWarQueryFixtureBase, new() | ||
{ | ||
protected GearsOfWarQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
protected virtual bool CanExecuteQueryString => false; | ||
|
||
protected override QueryAsserter CreateQueryAsserter(TFixture fixture) | ||
=> new RelationalQueryAsserter(fixture, RewriteExpectedQueryExpression, RewriteServerQueryExpression, canExecuteQueryString: CanExecuteQueryString); | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
test/EFCore.Relational.Specification.Tests/Query/ManyToManyQueryRelationalFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,12 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.EntityFrameworkCore.TestModels.ManyToManyModel; | ||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class ManyToManyQueryRelationalFixture : ManyToManyQueryFixtureBase | ||
{ | ||
public TestSqlLoggerFactory TestSqlLoggerFactory => (TestSqlLoggerFactory)ListLoggerFactory; | ||
|
||
protected override QueryAsserter<ManyToManyContext> CreateQueryAsserter( | ||
Dictionary<Type, object> entitySorters, | ||
Dictionary<Type, object> entityAsserters) | ||
=> new RelationalQueryAsserter<ManyToManyContext>( | ||
CreateContext, | ||
new ManyToManyData(), | ||
entitySorters, | ||
entityAsserters, | ||
CanExecuteQueryString); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
test/EFCore.Relational.Specification.Tests/Query/ManyToManyQueryRelationalTestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class ManyToManyQueryRelationalTestBase<TFixture> : ManyToManyQueryTestBase<TFixture> | ||
where TFixture : ManyToManyQueryFixtureBase, new() | ||
{ | ||
protected ManyToManyQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
protected virtual bool CanExecuteQueryString => false; | ||
|
||
protected override QueryAsserter CreateQueryAsserter(TFixture fixture) | ||
=> new RelationalQueryAsserter(fixture, RewriteExpectedQueryExpression, RewriteServerQueryExpression, canExecuteQueryString: CanExecuteQueryString); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...elational.Specification.Tests/Query/NorthwindAggregateOperatorsQueryRelationalTestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class NorthwindAggregateOperatorsQueryRelationalTestBase<TFixture> : NorthwindAggregateOperatorsQueryTestBase<TFixture> | ||
where TFixture : NorthwindQueryFixtureBase<NoopModelCustomizer>, new() | ||
{ | ||
protected NorthwindAggregateOperatorsQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
protected virtual bool CanExecuteQueryString => false; | ||
|
||
protected override QueryAsserter CreateQueryAsserter(TFixture fixture) | ||
=> new RelationalQueryAsserter(fixture, RewriteExpectedQueryExpression, RewriteServerQueryExpression, canExecuteQueryString: CanExecuteQueryString); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...FCore.Relational.Specification.Tests/Query/NorthwindAsyncSimpleQueryRelationalTestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class NorthwindAsyncSimpleQueryRelationalTestBase<TFixture> : NorthwindAsyncSimpleQueryTestBase<TFixture> | ||
where TFixture : NorthwindQueryFixtureBase<NoopModelCustomizer>, new() | ||
{ | ||
protected NorthwindAsyncSimpleQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
protected virtual bool CanExecuteQueryString => false; | ||
|
||
protected override QueryAsserter CreateQueryAsserter(TFixture fixture) | ||
=> new RelationalQueryAsserter(fixture, RewriteExpectedQueryExpression, RewriteServerQueryExpression, canExecuteQueryString: CanExecuteQueryString); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
.../EFCore.Relational.Specification.Tests/Query/NorthwindFunctionsQueryRelationalTestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class NorthwindFunctionsQueryRelationalTestBase<TFixture> : NorthwindFunctionsQueryTestBase<TFixture> | ||
where TFixture : NorthwindQueryFixtureBase<NoopModelCustomizer>, new() | ||
{ | ||
protected NorthwindFunctionsQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
protected virtual bool CanExecuteQueryString => false; | ||
|
||
protected override QueryAsserter CreateQueryAsserter(TFixture fixture) | ||
=> new RelationalQueryAsserter(fixture, RewriteExpectedQueryExpression, RewriteServerQueryExpression, canExecuteQueryString: CanExecuteQueryString); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
test/EFCore.Relational.Specification.Tests/Query/NorthwindGroupByQueryRelationalTestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class NorthwindGroupByQueryRelationalTestBase<TFixture> : NorthwindGroupByQueryTestBase<TFixture> | ||
where TFixture : NorthwindQueryFixtureBase<NoopModelCustomizer>, new() | ||
{ | ||
protected NorthwindGroupByQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
protected virtual bool CanExecuteQueryString => false; | ||
|
||
protected override QueryAsserter CreateQueryAsserter(TFixture fixture) | ||
=> new RelationalQueryAsserter(fixture, RewriteExpectedQueryExpression, RewriteServerQueryExpression, canExecuteQueryString: CanExecuteQueryString); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
test/EFCore.Relational.Specification.Tests/Query/NorthwindIncludeQueryRelationalTestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class NorthwindIncludeQueryRelationalTestBase<TFixture> : NorthwindIncludeQueryTestBase<TFixture> | ||
where TFixture : NorthwindQueryFixtureBase<NoopModelCustomizer>, new() | ||
{ | ||
protected NorthwindIncludeQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
protected virtual bool CanExecuteQueryString => false; | ||
|
||
protected override QueryAsserter CreateQueryAsserter(TFixture fixture) | ||
=> new RelationalQueryAsserter(fixture, RewriteExpectedQueryExpression, RewriteServerQueryExpression, canExecuteQueryString: CanExecuteQueryString); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
test/EFCore.Relational.Specification.Tests/Query/NorthwindJoinQueryRelationalTestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class NorthwindJoinQueryRelationalTestBase<TFixture> : NorthwindJoinQueryTestBase<TFixture> | ||
where TFixture : NorthwindQueryFixtureBase<NoopModelCustomizer>, new() | ||
{ | ||
protected NorthwindJoinQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
protected virtual bool CanExecuteQueryString => false; | ||
|
||
protected override QueryAsserter CreateQueryAsserter(TFixture fixture) | ||
=> new RelationalQueryAsserter(fixture, RewriteExpectedQueryExpression, RewriteServerQueryExpression, canExecuteQueryString: CanExecuteQueryString); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...e.Relational.Specification.Tests/Query/NorthwindKeylessEntitiesQueryRelationalTestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class NorthwindKeylessEntitiesQueryRelationalTestBase<TFixture> : NorthwindKeylessEntitiesQueryTestBase<TFixture> | ||
where TFixture : NorthwindQueryFixtureBase<NoopModelCustomizer>, new() | ||
{ | ||
protected NorthwindKeylessEntitiesQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
protected virtual bool CanExecuteQueryString => false; | ||
|
||
protected override QueryAsserter CreateQueryAsserter(TFixture fixture) | ||
=> new RelationalQueryAsserter(fixture, RewriteExpectedQueryExpression, RewriteServerQueryExpression, canExecuteQueryString: CanExecuteQueryString); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...ore.Relational.Specification.Tests/Query/NorthwindMiscellaneousQueryRelationalTestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class NorthwindMiscellaneousQueryRelationalTestBase<TFixture> : NorthwindMiscellaneousQueryTestBase<TFixture> | ||
where TFixture : NorthwindQueryFixtureBase<NoopModelCustomizer>, new() | ||
{ | ||
protected NorthwindMiscellaneousQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
protected virtual bool CanExecuteQueryString => false; | ||
|
||
protected override QueryAsserter CreateQueryAsserter(TFixture fixture) | ||
=> new RelationalQueryAsserter(fixture, RewriteExpectedQueryExpression, RewriteServerQueryExpression, canExecuteQueryString: CanExecuteQueryString); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...FCore.Relational.Specification.Tests/Query/NorthwindNavigationsQueryRelationalTestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public abstract class NorthwindNavigationsQueryRelationalTestBase<TFixture> : NorthwindNavigationsQueryTestBase<TFixture> | ||
where TFixture : NorthwindQueryFixtureBase<NoopModelCustomizer>, new() | ||
{ | ||
protected NorthwindNavigationsQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
protected virtual bool CanExecuteQueryString => false; | ||
|
||
protected override QueryAsserter CreateQueryAsserter(TFixture fixture) | ||
=> new RelationalQueryAsserter(fixture, RewriteExpectedQueryExpression, RewriteServerQueryExpression, canExecuteQueryString: CanExecuteQueryString); | ||
} | ||
} |
Oops, something went wrong.