Skip to content

Make IsAsyncData readonly and use collection initializers #35786

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

Merged
merged 1 commit into from
Mar 14, 2025
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
2 changes: 1 addition & 1 deletion test/EFCore.Cosmos.FunctionalTests/ReloadTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Microsoft.EntityFrameworkCore;

public class ReloadTest : IClassFixture<ReloadTest.CosmosReloadTestFixture>
{
public static IEnumerable<object[]> IsAsyncData = [[false], [true]];
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];

private void AssertSql(params string[] expected)
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.EntityFrameworkCore.Storage;
[CosmosCondition(CosmosCondition.DoesNotUseTokenCredential)]
public class CosmosDatabaseCreatorTest
{
public static IEnumerable<object[]> IsAsyncData = [[false], [true]];
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];

[ConditionalFact]
public async Task EnsureCreated_returns_true_when_database_does_not_exist()
Expand Down
2 changes: 1 addition & 1 deletion test/EFCore.CrossStore.FunctionalTests/QueryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Microsoft.EntityFrameworkCore;

public class QueryTest
{
public static IEnumerable<object[]> IsAsyncData = new object[][] { [false], [true] };
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected MigrationsInfrastructureTestBase(TFixture fixture)

protected string ActiveProvider { get; private set; }

public static IEnumerable<object[]> IsAsyncData = [[false], [true]];
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];

// Database deletion can happen as async file operation and SQLClient
// doesn't account for this, so give some time for it to happen on slow C.I. machines
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected NorthwindSqlQueryTestBase(TFixture fixture)

protected TFixture Fixture { get; }

public static IEnumerable<object[]> IsAsyncData = new object[][] { [false], [true] };
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1326,5 +1326,5 @@ public class Post
public Blog? Blog { get; set; }
}

public static IEnumerable<object[]> IsAsyncData = new object[][] { [false], [true] };
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];
}
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ protected virtual int ShouldExecuteInNumberOfCommands(
protected StoreValueGenerationContext CreateContext()
=> Fixture.CreateContext();

public static IEnumerable<object[]> IsAsyncData = new object[][] { [false], [true] };
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];

protected virtual void AssertSql(params string[] expected)
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.EntityFrameworkCore.Query.Internal;

public class BufferedDataReaderTest
{
public static IEnumerable<object[]> IsAsyncData = new object[][] { [false], [true] };
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1374,5 +1374,5 @@ private Task<RelationalDataReader> ExecuteReader(
private Task<bool> Read(RelationalDataReader relationalReader, bool async)
=> async ? relationalReader.ReadAsync() : Task.FromResult(relationalReader.Read());

public static IEnumerable<object[]> IsAsyncData = new object[][] { [false], [true] };
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ private IRelationalCommand CreateRelationalCommand(
logCommandText,
parameters ?? []);

public static IEnumerable<object[]> IsAsyncData = new object[][] { [false], [true] };
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected BulkUpdatesTestBase(TFixture fixture)
protected virtual Expression RewriteServerQueryExpression(Expression serverQueryExpression)
=> serverQueryExpression;

public static IEnumerable<object[]> IsAsyncData = new object[][] { [false], [true] };
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];

public Task AssertDelete<TResult>(
bool async,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,5 @@ protected override Task SeedAsync(ConcurrencyDetectorDbContext context)
=> ConcurrencyDetectorDbContext.SeedAsync(context);
}

public static IEnumerable<object[]> IsAsyncData = new object[][] { [false], [true] };
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];
}
2 changes: 1 addition & 1 deletion test/EFCore.Specification.Tests/NonSharedModelTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Microsoft.EntityFrameworkCore;

public abstract class NonSharedModelTestBase : IAsyncLifetime
{
public static IEnumerable<object[]> IsAsyncData = [[false], [true]];
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];

protected abstract string StoreName { get; }
protected abstract ITestStoreFactory TestStoreFactory { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -854,5 +854,5 @@ protected async Task<int> CountAsync<T>(IAsyncEnumerable<T> source)
protected NorthwindContext CreateContext()
=> Fixture.CreateContext();

public static IEnumerable<object[]> IsAsyncData = new object[][] { [false], [true] };
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];
}
2 changes: 1 addition & 1 deletion test/EFCore.Specification.Tests/Query/QueryTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected virtual Expression RewriteServerQueryExpression(Expression serverQuery
protected virtual Expression RewriteExpectedQueryExpression(Expression expectedQueryExpression)
=> new ExpectedQueryRewritingVisitor().Visit(expectedQueryExpression);

public static IEnumerable<object[]> IsAsyncData = new object[][] { [false], [true] };
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];

public Task AssertQuery<TResult>(
bool async,
Expand Down
2 changes: 1 addition & 1 deletion test/EFCore.Specification.Tests/Update/UpdatesTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public abstract class UpdatesTestBase<TFixture>(TFixture fixture) : IClassFixtur
{
protected TFixture Fixture { get; } = fixture;

public static IEnumerable<object[]> IsAsyncData = new object[][] { [false], [true] };
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];

[ConditionalTheory] // Issue #25905
[InlineData(false)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1767,5 +1767,5 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
b => b.UseNetTopologySuite().ApplyConfiguration());
}

public static IEnumerable<object[]> IsAsyncData = new object[][] { [false], [true] };
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];
}