Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make StoreName a computed property in all fixtures (no behavioral changes) #28453

Merged
merged 1 commit into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion test/EFCore.AspNet.Specification.Tests/GrpcTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)

public abstract class GrpcFixtureBase : SharedStoreFixtureBase<GrpcContext>
{
protected override string StoreName { get; } = "GrpcTest";
protected override string StoreName
=> "GrpcTest";

protected override void Seed(GrpcContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ await base.ExecuteWithStrategyInTransactionAsync(

public class InMemoryFixture : GraphUpdatesFixtureBase
{
protected override string StoreName { get; } = "GraphUpdatesTest";
protected override string StoreName
=> "GraphUpdatesTest";

protected override ITestStoreFactory TestStoreFactory
=> InMemoryTestStoreFactory.Instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ protected override bool DoesChangeTracking

public class ProxyGraphUpdatesWithLazyLoadingInMemoryFixture : ProxyGraphUpdatesInMemoryFixtureBase
{
protected override string StoreName { get; } = "ProxyGraphLazyLoadingUpdatesTest";
protected override string StoreName
=> "ProxyGraphLazyLoadingUpdatesTest";

public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder)
=> base.AddOptions(builder.UseLazyLoadingProxies());
Expand Down Expand Up @@ -151,7 +152,8 @@ protected override bool DoesChangeTracking

public class ProxyGraphUpdatesWithChangeTrackingInMemoryFixture : ProxyGraphUpdatesInMemoryFixtureBase
{
protected override string StoreName { get; } = "ProxyGraphChangeTrackingUpdatesTest";
protected override string StoreName
=> "ProxyGraphChangeTrackingUpdatesTest";

public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder)
=> base.AddOptions(builder.UseChangeTrackingProxies());
Expand All @@ -177,7 +179,8 @@ protected override bool DoesChangeTracking

public class ProxyGraphUpdatesWithChangeTrackingInMemoryFixture : ProxyGraphUpdatesInMemoryFixtureBase
{
protected override string StoreName { get; } = "ProxyGraphLazyLoadingAndChangeTrackingUpdatesTest";
protected override string StoreName
=> "ProxyGraphLazyLoadingAndChangeTrackingUpdatesTest";

public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder)
=> base.AddOptions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ namespace Microsoft.EntityFrameworkCore;

public class UpdatesInMemoryWithSensitiveDataLoggingFixture : UpdatesInMemoryFixtureBase
{
protected override string StoreName { get; } = "UpdateTestSensitive";
protected override string StoreName
=> "UpdateTestSensitive";

protected override ITestStoreFactory TestStoreFactory
=> InMemoryTestStoreFactory.Instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ namespace Microsoft.EntityFrameworkCore;

public class UpdatesInMemoryWithoutSensitiveDataLoggingFixture : UpdatesInMemoryFixtureBase
{
protected override string StoreName { get; } = "UpdateTestInsensitive";
protected override string StoreName
=> "UpdateTestInsensitive";

protected override ITestStoreFactory TestStoreFactory
=> InMemoryTestStoreFactory.Instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public class ComplexNavigationsODataQueryTestFixture : ComplexNavigationsQuerySq
{
private IHost _selfHostServer;

protected override string StoreName { get; } = "ODataComplexNavigations";
protected override string StoreName
=> "ODataComplexNavigations";

public ComplexNavigationsODataQueryTestFixture()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public class GearsOfWarODataQueryTestFixture : GearsOfWarQuerySqlServerFixture,
{
private IHost _selfHostServer;

protected override string StoreName { get; } = "ODataGearsOfWarQueryTest";
protected override string StoreName
=> "ODataGearsOfWarQueryTest";

public GearsOfWarODataQueryTestFixture()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public class NorthwindODataQueryTestFixture : NorthwindQuerySqlServerFixture<Noo
{
private IHost _selfHostServer;

protected override string StoreName { get; } = "ODataNorthwind";
protected override string StoreName
=> "ODataNorthwind";

public NorthwindODataQueryTestFixture()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public virtual async Task Can_roundtrip()

Assert.Empty(TestSqlLoggerFactory.Log.Where(l => l.Level == LogLevel.Warning));
}

await using (var context = CreateContext())
{
var reading = await context.MeterReadings.SingleAsync();
Expand All @@ -38,7 +38,8 @@ public virtual async Task Can_roundtrip()
}
}

protected override string StoreName { get; } = "EntitySplittingTest";
protected override string StoreName
=> "EntitySplittingTest";

protected TestSqlLoggerFactory TestSqlLoggerFactory
=> (TestSqlLoggerFactory)ListLoggerFactory;
Expand All @@ -47,7 +48,7 @@ protected TestSqlLoggerFactory TestSqlLoggerFactory

protected void AssertSql(params string[] expected)
=> TestSqlLoggerFactory.AssertBaseline(expected);

protected virtual void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<MeterReading>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,8 @@ public abstract class
public new RelationalTestStore TestStore
=> (RelationalTestStore)base.TestStore;

protected override string StoreName { get; } = "MigrationsTest";
protected override string StoreName
=> "MigrationsTest";

public EmptyMigrationsContext CreateEmptyContext()
=> new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ protected EntitySplittingQueryFixtureBase()
{
}

protected override string StoreName { get; } = "EntitySplittingQueryTest";
protected override string StoreName
=> "EntitySplittingQueryTest";

public TestSqlLoggerFactory TestSqlLoggerFactory
=> (TestSqlLoggerFactory)ListLoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ protected enum ShipVia
public abstract class MappingQueryFixtureBase : SharedStoreFixtureBase<PoolableDbContext>
{
protected abstract string DatabaseSchema { get; }
protected override string StoreName { get; } = "Northwind";
protected override string StoreName
=> "Northwind";

public TestSqlLoggerFactory TestSqlLoggerFactory
=> (TestSqlLoggerFactory)ListLoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public IReadOnlyDictionary<Type, object> GetEntityAsserters()
},
}.ToDictionary(e => e.Key, e => (object)e.Value);

protected override string StoreName { get; } = "NullSemanticsQueryTest";
protected override string StoreName
=> "NullSemanticsQueryTest";

public new RelationalTestStore TestStore
=> (RelationalTestStore)base.TestStore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ namespace Microsoft.EntityFrameworkCore.Query;

public abstract class TPCGearsOfWarQueryRelationalFixture : GearsOfWarQueryFixtureBase
{
protected override string StoreName { get; } = "TPCGearsOfWarQueryTest";
protected override string StoreName
=> "TPCGearsOfWarQueryTest";

public new RelationalTestStore TestStore
=> (RelationalTestStore)base.TestStore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ namespace Microsoft.EntityFrameworkCore.Query;

public abstract class TPCManyToManyQueryRelationalFixture : ManyToManyQueryRelationalFixture
{
protected override string StoreName { get; } = "TPCManyToManyQueryTest";
protected override string StoreName
=> "TPCManyToManyQueryTest";

public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder)
=> base.AddOptions(builder).ConfigureWarnings(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ namespace Microsoft.EntityFrameworkCore.Query;

public abstract class TPCRelationshipsQueryRelationalFixture : InheritanceRelationshipsQueryRelationalFixture
{
protected override string StoreName { get; } = "TPCRelationships";
protected override string StoreName
=> "TPCRelationships";

public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder)
=> base.AddOptions(builder).ConfigureWarnings(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ namespace Microsoft.EntityFrameworkCore.Query;

public abstract class TPTGearsOfWarQueryRelationalFixture : GearsOfWarQueryFixtureBase
{
protected override string StoreName { get; } = "TPTGearsOfWarQueryTest";
protected override string StoreName
=> "TPTGearsOfWarQueryTest";

public new RelationalTestStore TestStore
=> (RelationalTestStore)base.TestStore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ namespace Microsoft.EntityFrameworkCore.Query;

public abstract class TPTManyToManyQueryRelationalFixture : ManyToManyQueryRelationalFixture
{
protected override string StoreName { get; } = "TPTManyToManyQueryTest";
protected override string StoreName
=> "TPTManyToManyQueryTest";

protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ namespace Microsoft.EntityFrameworkCore.Query;

public abstract class TPTRelationshipsQueryRelationalFixture : InheritanceRelationshipsQueryRelationalFixture
{
protected override string StoreName { get; } = "TPTRelationships";
protected override string StoreName
=> "TPTRelationships";

protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public override Task Can_use_optional_dependents_with_shared_concurrency_tokens(
// TODO: Issue #22060
=> Task.CompletedTask;

protected override string StoreName { get; } = "TPTTableSplittingTest";
protected override string StoreName
=> "TPTTableSplittingTest";

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,8 @@ public virtual async Task No_warn_when_save_optional_dependent_at_least_one_none
Assert.Empty(TestSqlLoggerFactory.Log.Where(l => l.Level == LogLevel.Warning));
}

protected override string StoreName { get; } = "TableSplittingTest";
protected override string StoreName
=> "TableSplittingTest";

protected TestSqlLoggerFactory TestSqlLoggerFactory
=> (TestSqlLoggerFactory)ListLoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1469,7 +1469,8 @@ protected DbContext CreateContext()

public abstract class TransactionFixtureBase : SharedStoreFixtureBase<PoolableDbContext>
{
protected override string StoreName { get; } = "TransactionTest";
protected override string StoreName
=> "TransactionTest";

protected override bool ShouldLogCategory(string logCategory)
=> logCategory == DbLoggerCategory.Database.Transaction.Name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ namespace Microsoft.EntityFrameworkCore.Update;

public abstract class StoreValueGenerationFixtureBase : SharedStoreFixtureBase<StoreValueGenerationContext>
{
protected override string StoreName { get; } = "StoreValueGenerationTest";
protected override string StoreName
=> "StoreValueGenerationTest";

protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
{
Expand Down
3 changes: 2 additions & 1 deletion test/EFCore.Specification.Tests/BuiltInDataTypesTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2103,7 +2103,8 @@ public virtual void Can_insert_query_multiline_string()

public abstract class BuiltInDataTypesFixtureBase : SharedStoreFixtureBase<PoolableDbContext>
{
protected override string StoreName { get; } = "BuiltInDataTypes";
protected override string StoreName
=> "BuiltInDataTypes";

public virtual int LongStringLength
=> 9000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ protected BronieContext CreateContext()

public abstract class CompositeKeyEndToEndFixtureBase : SharedStoreFixtureBase<DbContext>
{
protected override string StoreName { get; } = "CompositeKeyEndToEndTest";
protected override string StoreName
=> "CompositeKeyEndToEndTest";

protected override Type ContextType { get; } = typeof(BronieContext);
}
Expand Down
3 changes: 2 additions & 1 deletion test/EFCore.Specification.Tests/ConferencePlannerTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,8 @@ protected virtual void UseTransaction(DatabaseFacade facade, IDbContextTransacti

public abstract class ConferencePlannerFixtureBase : SharedStoreFixtureBase<ApplicationDbContext>
{
protected override string StoreName { get; } = "ConferencePlanner";
protected override string StoreName
=> "ConferencePlanner";

protected override bool UsePooling
=> false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public override void Object_to_string_conversion() { }

public abstract class ConvertToProviderTypesFixtureBase : BuiltInDataTypesFixtureBase
{
protected override string StoreName { get; } = "ConvertToProviderTypes";
protected override string StoreName
=> "ConvertToProviderTypes";

protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
{
Expand Down
3 changes: 2 additions & 1 deletion test/EFCore.Specification.Tests/CustomConvertersTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,8 @@ public class Layout

public abstract class CustomConvertersFixtureBase : BuiltInDataTypesFixtureBase
{
protected override string StoreName { get; } = "CustomConverters";
protected override string StoreName
=> "CustomConverters";

protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
{
Expand Down
3 changes: 2 additions & 1 deletion test/EFCore.Specification.Tests/DataAnnotationTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2813,7 +2813,8 @@ public virtual void InverseProperty_with_case_sensitive_clr_property()

public abstract class DataAnnotationFixtureBase : SharedStoreFixtureBase<PoolableDbContext>
{
protected override string StoreName { get; } = "DataAnnotations";
protected override string StoreName
=> "DataAnnotations";

protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
{
Expand Down
3 changes: 2 additions & 1 deletion test/EFCore.Specification.Tests/FieldMappingTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1970,7 +1970,8 @@ protected DbContext CreateContext()

public abstract class FieldMappingFixtureBase : SharedStoreFixtureBase<PoolableDbContext>
{
protected override string StoreName { get; } = "FieldMapping";
protected override string StoreName
=> "FieldMapping";

protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
{
Expand Down
3 changes: 2 additions & 1 deletion test/EFCore.Specification.Tests/FieldsOnlyLoadTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4607,7 +4607,8 @@ public override void DetectChanges(IStateManager stateManager)

public abstract class FieldsOnlyLoadFixtureBase : SharedStoreFixtureBase<PoolableDbContext>
{
protected override string StoreName { get; } = "FieldsOnlyLoadTest";
protected override string StoreName
=> "FieldsOnlyLoadTest";

protected override IServiceCollection AddServices(IServiceCollection serviceCollection)
=> base.AddServices(serviceCollection.AddScoped<IChangeDetector, ChangeDetectorProxy>());
Expand Down
3 changes: 2 additions & 1 deletion test/EFCore.Specification.Tests/FindTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,8 @@ protected DbContext CreateContext()

public abstract class FindFixtureBase : SharedStoreFixtureBase<PoolableDbContext>
{
protected override string StoreName { get; } = "FindTest";
protected override string StoreName
=> "FindTest";

protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6875,7 +6875,8 @@ public OwnedGenericComparableIntClassKey(int position)

public abstract class KeysWithConvertersFixtureBase : SharedStoreFixtureBase<PoolableDbContext>
{
protected override string StoreName { get; } = "KeysWithConverters";
protected override string StoreName
=> "KeysWithConverters";

protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context)
{
Expand Down
3 changes: 2 additions & 1 deletion test/EFCore.Specification.Tests/LazyLoadProxyTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2801,7 +2801,8 @@ public override void DetectChanges(IStateManager stateManager)

public abstract class LoadFixtureBase : SharedStoreFixtureBase<DbContext>
{
protected override string StoreName { get; } = "LazyLoadProxyTest";
protected override string StoreName
=> "LazyLoadProxyTest";

public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder)
=> base.AddOptions(builder.UseLazyLoadingProxies());
Expand Down
3 changes: 2 additions & 1 deletion test/EFCore.Specification.Tests/LoadTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6352,7 +6352,8 @@ public override void DetectChanges(IStateManager stateManager)

public abstract class LoadFixtureBase : SharedStoreFixtureBase<PoolableDbContext>
{
protected override string StoreName { get; } = "LoadTest";
protected override string StoreName
=> "LoadTest";

protected override IServiceCollection AddServices(IServiceCollection serviceCollection)
=> base.AddServices(serviceCollection.AddScoped<IChangeDetector, ChangeDetectorProxy>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,8 @@ protected virtual void RecordLog()

public abstract class ManyToManyFieldsLoadFixtureBase : ManyToManyFieldsQueryFixtureBase
{
protected override string StoreName { get; } = "ManyToManyFieldsLoadTest";
protected override string StoreName
=> "ManyToManyFieldsLoadTest";

public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder)
=> base.AddOptions(builder).ConfigureWarnings(
Expand Down
Loading