Skip to content

Commit 43b5f81

Browse files
authored
Make IsAsyncData readonly and use collection initializers (#35786)
1 parent b0da783 commit 43b5f81

File tree

17 files changed

+17
-17
lines changed

17 files changed

+17
-17
lines changed

Diff for: test/EFCore.Cosmos.FunctionalTests/ReloadTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Microsoft.EntityFrameworkCore;
77

88
public class ReloadTest : IClassFixture<ReloadTest.CosmosReloadTestFixture>
99
{
10-
public static IEnumerable<object[]> IsAsyncData = [[false], [true]];
10+
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];
1111

1212
private void AssertSql(params string[] expected)
1313
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);

Diff for: test/EFCore.Cosmos.FunctionalTests/Storage/CosmosDatabaseCreatorTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Microsoft.EntityFrameworkCore.Storage;
88
[CosmosCondition(CosmosCondition.DoesNotUseTokenCredential)]
99
public class CosmosDatabaseCreatorTest
1010
{
11-
public static IEnumerable<object[]> IsAsyncData = [[false], [true]];
11+
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];
1212

1313
[ConditionalFact]
1414
public async Task EnsureCreated_returns_true_when_database_does_not_exist()

Diff for: test/EFCore.CrossStore.FunctionalTests/QueryTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Microsoft.EntityFrameworkCore;
1010

1111
public class QueryTest
1212
{
13-
public static IEnumerable<object[]> IsAsyncData = new object[][] { [false], [true] };
13+
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];
1414

1515
[ConditionalTheory]
1616
[MemberData(nameof(IsAsyncData))]

Diff for: test/EFCore.Relational.Specification.Tests/Migrations/MigrationsInfrastructureTestBase.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected MigrationsInfrastructureTestBase(TFixture fixture)
2424

2525
protected string ActiveProvider { get; private set; }
2626

27-
public static IEnumerable<object[]> IsAsyncData = [[false], [true]];
27+
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];
2828

2929
// Database deletion can happen as async file operation and SQLClient
3030
// doesn't account for this, so give some time for it to happen on slow C.I. machines

Diff for: test/EFCore.Relational.Specification.Tests/Query/NorthwindSqlQueryTestBase.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ protected NorthwindSqlQueryTestBase(TFixture fixture)
2222

2323
protected TFixture Fixture { get; }
2424

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

2727
[ConditionalTheory]
2828
[MemberData(nameof(IsAsyncData))]

Diff for: test/EFCore.Relational.Specification.Tests/Query/PrecompiledQueryRelationalTestBase.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1326,5 +1326,5 @@ public class Post
13261326
public Blog? Blog { get; set; }
13271327
}
13281328

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

Diff for: test/EFCore.Relational.Specification.Tests/Update/StoreValueGenerationTestBase.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ protected virtual int ShouldExecuteInNumberOfCommands(
363363
protected StoreValueGenerationContext CreateContext()
364364
=> Fixture.CreateContext();
365365

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

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

Diff for: test/EFCore.Relational.Tests/Query/Internal/BufferedDataReaderTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Microsoft.EntityFrameworkCore.Query.Internal;
88

99
public class BufferedDataReaderTest
1010
{
11-
public static IEnumerable<object[]> IsAsyncData = new object[][] { [false], [true] };
11+
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];
1212

1313
[ConditionalTheory]
1414
[MemberData(nameof(IsAsyncData))]

Diff for: test/EFCore.Relational.Tests/Storage/RelationalCommandTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1374,5 +1374,5 @@ private Task<RelationalDataReader> ExecuteReader(
13741374
private Task<bool> Read(RelationalDataReader relationalReader, bool async)
13751375
=> async ? relationalReader.ReadAsync() : Task.FromResult(relationalReader.Read());
13761376

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

Diff for: test/EFCore.Relational.Tests/Storage/RelationalDataReaderTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,5 @@ private IRelationalCommand CreateRelationalCommand(
7373
logCommandText,
7474
parameters ?? []);
7575

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

Diff for: test/EFCore.Specification.Tests/BulkUpdates/BulkUpdatesTestBase.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ protected BulkUpdatesTestBase(TFixture fixture)
2121
protected virtual Expression RewriteServerQueryExpression(Expression serverQueryExpression)
2222
=> serverQueryExpression;
2323

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

2626
public Task AssertDelete<TResult>(
2727
bool async,

Diff for: test/EFCore.Specification.Tests/ConcurrencyDetectorTestBase.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,5 @@ protected override Task SeedAsync(ConcurrencyDetectorDbContext context)
9797
=> ConcurrencyDetectorDbContext.SeedAsync(context);
9898
}
9999

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

Diff for: test/EFCore.Specification.Tests/NonSharedModelTestBase.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Microsoft.EntityFrameworkCore;
77

88
public abstract class NonSharedModelTestBase : IAsyncLifetime
99
{
10-
public static IEnumerable<object[]> IsAsyncData = [[false], [true]];
10+
public static readonly IEnumerable<object[]> IsAsyncData = [[false], [true]];
1111

1212
protected abstract string StoreName { get; }
1313
protected abstract ITestStoreFactory TestStoreFactory { get; }

Diff for: test/EFCore.Specification.Tests/Query/NorthwindCompiledQueryTestBase.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -854,5 +854,5 @@ protected async Task<int> CountAsync<T>(IAsyncEnumerable<T> source)
854854
protected NorthwindContext CreateContext()
855855
=> Fixture.CreateContext();
856856

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

Diff for: test/EFCore.Specification.Tests/Query/QueryTestBase.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected virtual Expression RewriteServerQueryExpression(Expression serverQuery
3939
protected virtual Expression RewriteExpectedQueryExpression(Expression expectedQueryExpression)
4040
=> new ExpectedQueryRewritingVisitor().Visit(expectedQueryExpression);
4141

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

4444
public Task AssertQuery<TResult>(
4545
bool async,

Diff for: test/EFCore.Specification.Tests/Update/UpdatesTestBase.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public abstract class UpdatesTestBase<TFixture>(TFixture fixture) : IClassFixtur
1414
{
1515
protected TFixture Fixture { get; } = fixture;
1616

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

1919
[ConditionalTheory] // Issue #25905
2020
[InlineData(false)]

Diff for: test/EFCore.SqlServer.FunctionalTests/SqlServerValueGenerationScenariosTestBase.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1767,5 +1767,5 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
17671767
b => b.UseNetTopologySuite().ApplyConfiguration());
17681768
}
17691769

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

0 commit comments

Comments
 (0)