-
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.
These only adds disabled test classes Part of #3170
- Loading branch information
Showing
35 changed files
with
8,280 additions
and
10 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
test/EFCore.Relational.Specification.Tests/Query/TPCFiltersInheritanceQueryTestBase.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,15 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
// ReSharper disable InconsistentNaming | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query; | ||
|
||
public abstract class TPCFiltersInheritanceQueryTestBase<TFixture> : FiltersInheritanceQueryTestBase<TFixture> | ||
where TFixture : TPCInheritanceQueryFixture, new() | ||
{ | ||
public TPCFiltersInheritanceQueryTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
test/EFCore.Relational.Specification.Tests/Query/TPCGearsOfWarQueryRelationalFixture.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,42 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Microsoft.EntityFrameworkCore.TestModels.GearsOfWarModel; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query; | ||
|
||
public abstract class TPCGearsOfWarQueryRelationalFixture : GearsOfWarQueryFixtureBase | ||
{ | ||
protected override string StoreName { get; } = "TPCGearsOfWarQueryTest"; | ||
|
||
public new RelationalTestStore TestStore | ||
=> (RelationalTestStore)base.TestStore; | ||
|
||
public TestSqlLoggerFactory TestSqlLoggerFactory | ||
=> (TestSqlLoggerFactory)ListLoggerFactory; | ||
|
||
protected override bool ShouldLogCategory(string logCategory) | ||
=> logCategory == DbLoggerCategory.Query.Name; | ||
|
||
public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) | ||
=> base.AddOptions(builder).ConfigureWarnings( | ||
w => | ||
w.Log(RelationalEventId.ForeignKeyTpcPrincipalWarning)); | ||
|
||
protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) | ||
{ | ||
base.OnModelCreating(modelBuilder, context); | ||
|
||
modelBuilder.Entity<Gear>().UseTpcMappingStrategy(); | ||
modelBuilder.Entity<Faction>().UseTpcMappingStrategy(); | ||
modelBuilder.Entity<LocustLeader>().UseTpcMappingStrategy(); | ||
|
||
modelBuilder.Entity<Gear>().ToTable("Gears"); | ||
modelBuilder.Entity<Officer>().ToTable("Officers"); | ||
|
||
modelBuilder.Entity<LocustHorde>().ToTable("LocustHordes"); | ||
|
||
modelBuilder.Entity<LocustLeader>().ToTable("LocustLeaders"); | ||
modelBuilder.Entity<LocustCommander>().ToTable("LocustCommanders"); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
test/EFCore.Relational.Specification.Tests/Query/TPCGearsOfWarQueryRelationalTestBase.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,16 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query; | ||
|
||
public abstract class TPCGearsOfWarQueryRelationalTestBase<TFixture> : GearsOfWarQueryRelationalTestBase<TFixture> | ||
where TFixture : TPCGearsOfWarQueryRelationalFixture, new() | ||
{ | ||
protected TPCGearsOfWarQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
public override Task Project_discriminator_columns(bool async) | ||
=> AssertUnableToTranslateEFProperty(() => base.Project_discriminator_columns(async)); | ||
} |
57 changes: 57 additions & 0 deletions
57
test/EFCore.Relational.Specification.Tests/Query/TPCInheritanceQueryFixture.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,57 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Microsoft.EntityFrameworkCore.TestModels.InheritanceModel; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query; | ||
|
||
public abstract class TPCInheritanceQueryFixture : InheritanceQueryFixtureBase | ||
{ | ||
protected override string StoreName | ||
=> "TPCInheritanceTest"; | ||
|
||
public TestSqlLoggerFactory TestSqlLoggerFactory | ||
=> (TestSqlLoggerFactory)ListLoggerFactory; | ||
|
||
protected override bool HasDiscriminator | ||
=> false; | ||
|
||
protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) | ||
{ | ||
base.OnModelCreating(modelBuilder, context); | ||
|
||
// Configure TPT for hierarchies | ||
modelBuilder.Entity<Plant>().UseTpcMappingStrategy(); | ||
modelBuilder.Entity<Animal>().UseTpcMappingStrategy(); | ||
modelBuilder.Entity<Drink>().UseTpcMappingStrategy(); | ||
|
||
modelBuilder.Entity<Flower>().ToTable("Flowers"); | ||
modelBuilder.Entity<Rose>().ToTable("Roses"); | ||
modelBuilder.Entity<Daisy>().ToTable("Daisies"); | ||
modelBuilder.Entity<Country>().Property(e => e.Id).ValueGeneratedNever(); | ||
|
||
modelBuilder.Entity<Bird>().ToTable("Birds"); | ||
modelBuilder.Entity<Eagle>().ToTable("Eagle"); | ||
modelBuilder.Entity<Kiwi>().ToTable("Kiwi"); | ||
modelBuilder.Entity<Animal>().Property(e => e.Species).HasMaxLength(100); | ||
modelBuilder.Entity<Eagle>().HasMany(e => e.Prey).WithOne().HasForeignKey(e => e.EagleId).IsRequired(false); | ||
|
||
modelBuilder.Entity<Drink>().ToTable("Drinks"); | ||
modelBuilder.Entity<Coke>().ToTable("Coke"); | ||
modelBuilder.Entity<Lilt>().ToTable("Lilt"); | ||
modelBuilder.Entity<Tea>().ToTable("Tea"); | ||
|
||
modelBuilder.Entity<Coke>().Property(e => e.Carbonation).HasColumnName("CokeCO2"); | ||
modelBuilder.Entity<Coke>().Property(e => e.SugarGrams).HasColumnName("SugarGrams"); | ||
modelBuilder.Entity<Coke>().Property(e => e.CaffeineGrams).HasColumnName("CaffeineGrams"); | ||
modelBuilder.Entity<Lilt>().Property(e => e.Carbonation).HasColumnName("LiltCO2"); | ||
modelBuilder.Entity<Lilt>().Property(e => e.SugarGrams).HasColumnName("SugarGrams"); | ||
modelBuilder.Entity<Tea>().Property(e => e.CaffeineGrams).HasColumnName("CaffeineGrams"); | ||
|
||
// Keyless entities are mapped to TPH so ignoring them | ||
modelBuilder.Ignore<AnimalQuery>(); | ||
modelBuilder.Ignore<BirdQuery>(); | ||
modelBuilder.Ignore<KiwiQuery>(); | ||
modelBuilder.Ignore<EagleQuery>(); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
test/EFCore.Relational.Specification.Tests/Query/TPCInheritanceQueryTestBase.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,55 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
// ReSharper disable InconsistentNaming | ||
|
||
using Microsoft.EntityFrameworkCore.TestModels.InheritanceModel; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query; | ||
|
||
public abstract class TPCInheritanceQueryTestBase<TFixture> : InheritanceQueryTestBase<TFixture> | ||
where TFixture : TPCInheritanceQueryFixture, new() | ||
{ | ||
public TPCInheritanceQueryTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
|
||
// Keyless entities does not have TPC | ||
public override Task Can_query_all_animal_views(bool async) | ||
=> Task.CompletedTask; | ||
|
||
// TPC does not have discriminator | ||
public override Task Discriminator_used_when_projection_over_derived_type(bool async) | ||
=> Task.CompletedTask; | ||
|
||
// TPC does not have discriminator | ||
public override Task Discriminator_used_when_projection_over_derived_type2(bool async) | ||
=> Task.CompletedTask; | ||
|
||
// TPC does not have discriminator | ||
public override Task Discriminator_used_when_projection_over_of_type(bool async) | ||
=> Task.CompletedTask; | ||
|
||
// TPC does not have discriminator | ||
public override Task Discriminator_with_cast_in_shadow_property(bool async) | ||
=> Task.CompletedTask; | ||
|
||
[ConditionalFact] | ||
public virtual void Using_from_sql_throws() | ||
{ | ||
using var context = CreateContext(); | ||
|
||
var message = Assert.Throws<InvalidOperationException>(() => context.Set<Bird>().FromSqlRaw("Select * from Birds")).Message; | ||
|
||
Assert.Equal(RelationalStrings.MethodOnNonTphRootNotSupported("FromSqlRaw", typeof(Bird).Name), message); | ||
|
||
message = Assert.Throws<InvalidOperationException>(() => context.Set<Bird>().FromSqlInterpolated($"Select * from Birds")) | ||
.Message; | ||
|
||
Assert.Equal(RelationalStrings.MethodOnNonTphRootNotSupported("FromSqlInterpolated", typeof(Bird).Name), message); | ||
} | ||
|
||
protected override void UseTransaction(DatabaseFacade facade, IDbContextTransaction transaction) | ||
=> facade.UseTransaction(transaction.GetDbTransaction()); | ||
} |
13 changes: 13 additions & 0 deletions
13
...re.Relational.Specification.Tests/Query/TPCManyToManyNoTrackingQueryRelationalTestBase.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,13 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query; | ||
|
||
public abstract class TPCManyToManyNoTrackingQueryRelationalTestBase<TFixture> : ManyToManyNoTrackingQueryRelationalTestBase<TFixture> | ||
where TFixture : TPCManyToManyQueryRelationalFixture, new() | ||
{ | ||
protected TPCManyToManyNoTrackingQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
test/EFCore.Relational.Specification.Tests/Query/TPCManyToManyQueryRelationalFixture.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,27 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Microsoft.EntityFrameworkCore.TestModels.ManyToManyModel; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query; | ||
|
||
public abstract class TPCManyToManyQueryRelationalFixture : ManyToManyQueryRelationalFixture | ||
{ | ||
protected override string StoreName { get; } = "TPCManyToManyQueryTest"; | ||
|
||
public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) | ||
=> base.AddOptions(builder).ConfigureWarnings( | ||
w => | ||
w.Log(RelationalEventId.ForeignKeyTpcPrincipalWarning)); | ||
|
||
protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) | ||
{ | ||
base.OnModelCreating(modelBuilder, context); | ||
|
||
modelBuilder.Entity<EntityRoot>().UseTpcMappingStrategy(); | ||
|
||
modelBuilder.Entity<EntityRoot>().ToTable("Roots"); | ||
modelBuilder.Entity<EntityBranch>().ToTable("Branches"); | ||
modelBuilder.Entity<EntityLeaf>().ToTable("Leaves"); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
test/EFCore.Relational.Specification.Tests/Query/TPCManyToManyQueryRelationalTestBase.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,13 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query; | ||
|
||
public abstract class TPCManyToManyQueryRelationalTestBase<TFixture> : ManyToManyQueryRelationalTestBase<TFixture> | ||
where TFixture : TPCManyToManyQueryRelationalFixture, new() | ||
{ | ||
protected TPCManyToManyQueryRelationalTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
test/EFCore.Relational.Specification.Tests/Query/TPCRelationshipsQueryRelationalFixture.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,39 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationshipsModel; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query; | ||
|
||
public abstract class TPCRelationshipsQueryRelationalFixture : InheritanceRelationshipsQueryRelationalFixture | ||
{ | ||
protected override string StoreName { get; } = "TPCRelationships"; | ||
|
||
public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) | ||
=> base.AddOptions(builder).ConfigureWarnings( | ||
w => | ||
w.Log(RelationalEventId.ForeignKeyTpcPrincipalWarning)); | ||
|
||
protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) | ||
{ | ||
base.OnModelCreating(modelBuilder, context); | ||
|
||
modelBuilder.Entity<BaseInheritanceRelationshipEntity>().UseTpcMappingStrategy(); | ||
modelBuilder.Entity<BaseReferenceOnBase>().UseTpcMappingStrategy(); | ||
modelBuilder.Entity<BaseCollectionOnBase>().UseTpcMappingStrategy(); | ||
modelBuilder.Entity<BaseReferenceOnDerived>().UseTpcMappingStrategy(); | ||
modelBuilder.Entity<BaseCollectionOnDerived>().UseTpcMappingStrategy(); | ||
modelBuilder.Entity<NestedReferenceBase>().UseTpcMappingStrategy(); | ||
modelBuilder.Entity<NestedCollectionBase>().UseTpcMappingStrategy(); | ||
|
||
modelBuilder.Entity<DerivedInheritanceRelationshipEntity>().ToTable("DerivedEntities"); | ||
|
||
modelBuilder.Entity<DerivedReferenceOnBase>().ToTable("DerivedReferencesOnBase"); | ||
modelBuilder.Entity<DerivedCollectionOnBase>().ToTable("DerivedCollectionsOnBase"); | ||
modelBuilder.Entity<DerivedReferenceOnDerived>().ToTable("DerivedReferencesOnDerived"); | ||
modelBuilder.Entity<DerivedCollectionOnDerived>().ToTable("DerivedCollectionsOnDerived"); | ||
|
||
modelBuilder.Entity<NestedReferenceDerived>().ToTable("NestedReferencesDerived"); | ||
modelBuilder.Entity<NestedCollectionDerived>().ToTable("NestedCollectionsDerived"); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
test/EFCore.Relational.Specification.Tests/Query/TPCRelationshipsQueryTestBase.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,15 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
// ReSharper disable InconsistentNaming | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query; | ||
|
||
public abstract class TPCRelationshipsQueryTestBase<TFixture> : InheritanceRelationshipsQueryRelationalTestBase<TFixture> | ||
where TFixture : TPCRelationshipsQueryRelationalFixture, new() | ||
{ | ||
protected TPCRelationshipsQueryTestBase(TFixture fixture) | ||
: base(fixture) | ||
{ | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.