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

(RC2) (Test only) Code cleanup (Tests) #34490

Merged
merged 3 commits into from
Aug 21, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ public static TestWebHost BuildWebHost(string[] args)
}
}

public class TestAppServiceProviderFactory(Assembly startupAssembly, IOperationReporter reporter = null) : AppServiceProviderFactory(startupAssembly, reporter ?? new TestOperationReporter());
public class TestAppServiceProviderFactory(Assembly startupAssembly, IOperationReporter reporter = null)
: AppServiceProviderFactory(startupAssembly, reporter ?? new TestOperationReporter());

public class TestWebHost(IServiceProvider services)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

namespace Microsoft.EntityFrameworkCore;

public class AspNetIdentityCustomTypesDefaultInMemoryTest(AspNetIdentityCustomTypesDefaultInMemoryTest.AspNetIdentityCustomTypesDefaultInMemoryFixture fixture)
public class AspNetIdentityCustomTypesDefaultInMemoryTest(
AspNetIdentityCustomTypesDefaultInMemoryTest.AspNetIdentityCustomTypesDefaultInMemoryFixture fixture)
: AspNetIdentityCustomTypesDefaultTestBase<
AspNetIdentityCustomTypesDefaultInMemoryTest.AspNetIdentityCustomTypesDefaultInMemoryFixture>(fixture)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

namespace Microsoft.EntityFrameworkCore;

public class AspNetIdentityCustomTypesIntKeyInMemoryTest(AspNetIdentityCustomTypesIntKeyInMemoryTest.AspNetIdentityCustomTypesIntKeyInMemoryFixture fixture)
public class AspNetIdentityCustomTypesIntKeyInMemoryTest(
AspNetIdentityCustomTypesIntKeyInMemoryTest.AspNetIdentityCustomTypesIntKeyInMemoryFixture fixture)
: AspNetIdentityCustomTypesIntKeyTestBase<
AspNetIdentityCustomTypesIntKeyInMemoryTest.AspNetIdentityCustomTypesIntKeyInMemoryFixture>(fixture)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,10 @@ protected override List<EntityTypeMapping> ExpectedMappings
];
}

public class CustomTypesIdentityContext(DbContextOptions options) : IdentityDbContext<CustomUserString, CustomRoleString, string, CustomUserClaimString,
CustomUserRoleString,
CustomUserLoginString, CustomRoleClaimString, CustomUserTokenString>(options)
public class CustomTypesIdentityContext(DbContextOptions options)
: IdentityDbContext<CustomUserString, CustomRoleString, string, CustomUserClaimString,
CustomUserRoleString,
CustomUserLoginString, CustomRoleClaimString, CustomUserTokenString>(options)
{
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
Expand Down Expand Up @@ -405,9 +406,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
public class CustomUserString : IdentityUser<string>
{
public CustomUserString()
{
Id = Guid.NewGuid().ToString();
}
=> Id = Guid.NewGuid().ToString();

public string CustomTag { get; set; }

Expand All @@ -422,9 +421,7 @@ public CustomUserString()
public class CustomRoleString : IdentityRole<string>
{
public CustomRoleString()
{
Id = Guid.NewGuid().ToString();
}
=> Id = Guid.NewGuid().ToString();

public virtual ICollection<CustomUserString> Users { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ protected override List<EntityTypeMapping> ExpectedMappings
];
}

public class CustomTypesIdentityContextInt(DbContextOptions options) : IdentityDbContext<CustomUserInt, CustomRoleInt, int, CustomUserClaimInt, CustomUserRoleInt,
CustomUserLoginInt, CustomRoleClaimInt, CustomUserTokenInt>(options)
public class CustomTypesIdentityContextInt(DbContextOptions options)
: IdentityDbContext<CustomUserInt, CustomRoleInt, int, CustomUserClaimInt, CustomUserRoleInt,
CustomUserLoginInt, CustomRoleClaimInt, CustomUserTokenInt>(options)
{
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,14 @@ private static async Task SaveApiResources(ConfigurationDbContext context)
Name = "ApiResource1",
DisplayName = "ApiResource 1",
Description = "ApiResource 1",
Scopes = [new() { Scope = "S1" }, new() { Scope = "S2" }]
Scopes = [new ApiResourceScope { Scope = "S1" }, new ApiResourceScope { Scope = "S2" }]
},
new ApiResource
{
Name = "ApiResource2",
DisplayName = "ApiResource 2",
Description = "ApiResource 2",
Scopes = [new() { Scope = "S4" }, new() { Scope = "S5" }]
Scopes = [new ApiResourceScope { Scope = "S4" }, new ApiResourceScope { Scope = "S5" }]
},
new ApiResource
{
Expand Down
4 changes: 1 addition & 3 deletions test/EFCore.AspNet.Specification.Tests/GrpcTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ public abstract class GrpcTestBase<TFixture> : IClassFixture<TFixture>
where TFixture : GrpcTestBase<TFixture>.GrpcFixtureBase
{
protected GrpcTestBase(TFixture fixture)
{
Fixture = fixture;
}
=> Fixture = fixture;

protected TFixture Fixture { get; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

namespace Microsoft.EntityFrameworkCore;

public class AspNetIdentityCustomTypesDefaultSqlServerTest(AspNetIdentityCustomTypesDefaultSqlServerTest.AspNetIdentityCustomTypesDefaultSqlServerFixture fixture)
public class AspNetIdentityCustomTypesDefaultSqlServerTest(
AspNetIdentityCustomTypesDefaultSqlServerTest.AspNetIdentityCustomTypesDefaultSqlServerFixture fixture)
: AspNetIdentityCustomTypesDefaultTestBase<
AspNetIdentityCustomTypesDefaultSqlServerTest.AspNetIdentityCustomTypesDefaultSqlServerFixture>(fixture)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

namespace Microsoft.EntityFrameworkCore;

public class AspNetIdentityCustomTypesIntKeySqlServerTest(AspNetIdentityCustomTypesIntKeySqlServerTest.AspNetIdentityCustomTypesIntKeySqlServerFixture fixture)
public class AspNetIdentityCustomTypesIntKeySqlServerTest(
AspNetIdentityCustomTypesIntKeySqlServerTest.AspNetIdentityCustomTypesIntKeySqlServerFixture fixture)
: AspNetIdentityCustomTypesIntKeyTestBase<
AspNetIdentityCustomTypesIntKeySqlServerTest.AspNetIdentityCustomTypesIntKeySqlServerFixture>(fixture)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Microsoft.EntityFrameworkCore;

public class AspNetIdentityIntKeySqlServerTest(AspNetIdentityIntKeySqlServerTest.AspNetIdentityIntKeySqlServerFixture fixture)
: AspNetIdentityIntKeyTestBase<AspNetIdentityIntKeySqlServerTest.AspNetIdentityIntKeySqlServerFixture>(fixture)
: AspNetIdentityIntKeyTestBase<AspNetIdentityIntKeySqlServerTest.AspNetIdentityIntKeySqlServerFixture>(fixture)
{
public class AspNetIdentityIntKeySqlServerFixture : AspNetIdentityFixtureBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ namespace Microsoft.EntityFrameworkCore;

#if !EXCLUDE_ON_MAC

public class GrpcSqlServerTest(GrpcSqlServerTest.GrpcSqlServerFixture fixture) : GrpcTestBase<GrpcSqlServerTest.GrpcSqlServerFixture>(fixture)
public class GrpcSqlServerTest(GrpcSqlServerTest.GrpcSqlServerFixture fixture)
: GrpcTestBase<GrpcSqlServerTest.GrpcSqlServerFixture>(fixture)
{
public class GrpcSqlServerFixture : GrpcFixtureBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

namespace Microsoft.EntityFrameworkCore;

public class AspNetIdentityCustomTypesDefaultSqliteTest(AspNetIdentityCustomTypesDefaultSqliteTest.AspNetIdentityCustomTypesDefaultSqliteFixture fixture)
: AspNetIdentityCustomTypesDefaultTestBase<AspNetIdentityCustomTypesDefaultSqliteTest.AspNetIdentityCustomTypesDefaultSqliteFixture>(fixture)
public class AspNetIdentityCustomTypesDefaultSqliteTest(
AspNetIdentityCustomTypesDefaultSqliteTest.AspNetIdentityCustomTypesDefaultSqliteFixture fixture)
: AspNetIdentityCustomTypesDefaultTestBase<AspNetIdentityCustomTypesDefaultSqliteTest.AspNetIdentityCustomTypesDefaultSqliteFixture>(
fixture)
{
public class AspNetIdentityCustomTypesDefaultSqliteFixture : AspNetIdentityFixtureBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

namespace Microsoft.EntityFrameworkCore;

public class AspNetIdentityCustomTypesIntKeySqliteTest(AspNetIdentityCustomTypesIntKeySqliteTest.AspNetIdentityCustomTypesIntKeySqliteFixture fixture)
: AspNetIdentityCustomTypesIntKeyTestBase<AspNetIdentityCustomTypesIntKeySqliteTest.AspNetIdentityCustomTypesIntKeySqliteFixture>(fixture)
public class AspNetIdentityCustomTypesIntKeySqliteTest(
AspNetIdentityCustomTypesIntKeySqliteTest.AspNetIdentityCustomTypesIntKeySqliteFixture fixture)
: AspNetIdentityCustomTypesIntKeyTestBase<AspNetIdentityCustomTypesIntKeySqliteTest.AspNetIdentityCustomTypesIntKeySqliteFixture>(
fixture)
{
public class AspNetIdentityCustomTypesIntKeySqliteFixture : AspNetIdentityFixtureBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ namespace Microsoft.EntityFrameworkCore;

#nullable disable

public class ConcurrencyDetectorEnabledCosmosTest(ConcurrencyDetectorEnabledCosmosTest.ConcurrencyDetectorCosmosFixture fixture) : ConcurrencyDetectorEnabledTestBase<
ConcurrencyDetectorEnabledCosmosTest.ConcurrencyDetectorCosmosFixture>(fixture)
public class ConcurrencyDetectorEnabledCosmosTest(ConcurrencyDetectorEnabledCosmosTest.ConcurrencyDetectorCosmosFixture fixture)
: ConcurrencyDetectorEnabledTestBase<
ConcurrencyDetectorEnabledCosmosTest.ConcurrencyDetectorCosmosFixture>(fixture)
{
[ConditionalTheory(Skip = "Issue #17246")]
public override Task Any(bool async)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public async Task Throws_for_missing_connection_info()
using var context = new NoConnectionContext();
var creator = context.GetService<IDatabaseCreator>();

Assert.Equal(CosmosStrings.ConnectionInfoMissing,
Assert.Equal(
CosmosStrings.ConnectionInfoMissing,
(await Assert.ThrowsAsync<InvalidOperationException>(() => creator.EnsureDeletedAsync())).Message);
}

Expand All @@ -49,7 +50,6 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
.ConfigureWarnings(w => w.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning));
}


public class Blog
{
public int Id { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ namespace Microsoft.EntityFrameworkCore;

#nullable disable

public class CosmosApiConsistencyTest(CosmosApiConsistencyTest.CosmosApiConsistencyFixture fixture) : ApiConsistencyTestBase<CosmosApiConsistencyTest.CosmosApiConsistencyFixture>(fixture)
public class CosmosApiConsistencyTest(CosmosApiConsistencyTest.CosmosApiConsistencyFixture fixture)
: ApiConsistencyTestBase<CosmosApiConsistencyTest.CosmosApiConsistencyFixture>(fixture)
{
protected override void AddServices(ServiceCollection serviceCollection)
=> serviceCollection.AddEntityFrameworkCosmos();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ public class CustomConvertersCosmosTest : CustomConvertersTestBase<CustomConvert
{
public CustomConvertersCosmosTest(CustomConvertersCosmosFixture fixture)
: base(fixture)
{
Fixture.TestSqlLoggerFactory.Clear();
}
=> Fixture.TestSqlLoggerFactory.Clear();

[ConditionalTheory(Skip = "Issue #17246 No Explicit Convert")]
public override Task Can_filter_projection_with_inline_enum_variable(bool async)
Expand Down
Loading