Skip to content

Commit 0790f78

Browse files
CopilotAndriySvyryd
authored andcommitted
Sweep test tree to use Arcade ConditionalFact/Theory/Class APIs
Mechanical conversions across test/**/*.cs: * [ConditionalFact] / [ConditionalTheory] (no condition attributes) -> [Fact] / [Theory]. ~10,623 occurrences plus inline-stacked variants such as [ConditionalTheory, MemberData(...)] and [ConditionalFact(Skip = ...)]. * [ConditionalFact] / [ConditionalTheory] companioned with an ITestCondition attribute (SqlServerCondition, CosmosCondition, PlatformSkipCondition, SkipOnHelixCondition, SkipOnCiCondition, SpatialiteRequired, SqliteVersionCondition) -> a single [ConditionalFact(typeof(SqlServerConditions), nameof(SqlServerConditions.X), ...)] referencing the static helpers added in the previous commit. Handles inline-stacked and adjacent-line forms. * Class-level orphan condition attributes -> [ConditionalClass(...)]. * Multi-line [PlatformSkipCondition(...)] blocks across MigrationsSqlServerTest, OperationExecutorTest, ConfigPatternsCosmosTest fixed manually; SkipReason text is dropped (Arcade surfaces the failing member name). * SqliteVersionCondition(Min=3.35.0) -> nameof(SqliteConditions.VersionAtLeast3_35). No other Min/Max combos exist in the tree. * using Microsoft.EntityFrameworkCore.TestUtilities.Xunit; removed from files that no longer reference that (now-deleted) namespace.
1 parent d43503e commit 0790f78

1,065 files changed

Lines changed: 18945 additions & 19067 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

EFCore.slnx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,17 @@
5959
<Project Path="test/EFCore.AspNet.InMemory.FunctionalTests/EFCore.AspNet.InMemory.FunctionalTests.csproj" />
6060
<Project Path="test/EFCore.AspNet.Specification.Tests/EFCore.AspNet.Specification.Tests.csproj" />
6161
<Project Path="test/EFCore.AspNet.Sqlite.FunctionalTests/EFCore.AspNet.Sqlite.FunctionalTests.csproj" />
62-
<Project Path="test/EFCore.AspNet.SqlServer.FunctionalTests/EFCore.AspNet.SqlServer.FunctionalTests.csproj" />
6362
<Project Path="test/EFCore.Cosmos.FunctionalTests/EFCore.Cosmos.FunctionalTests.csproj" />
6463
<Project Path="test/EFCore.Cosmos.Tests/EFCore.Cosmos.Tests.csproj" />
65-
<Project Path="test/EFCore.CrossStore.FunctionalTests/EFCore.CrossStore.FunctionalTests.csproj" />
66-
<Project Path="test/EFCore.Design.Tests/EFCore.Design.Tests.csproj" />
6764
<Project Path="test/EFCore.FSharp.FunctionalTests/EFCore.FSharp.FunctionalTests.fsproj" />
6865
<Project Path="test/EFCore.InMemory.FunctionalTests/EFCore.InMemory.FunctionalTests.csproj" />
6966
<Project Path="test/EFCore.InMemory.Tests/EFCore.InMemory.Tests.csproj" />
70-
<Project Path="test/EFCore.OData.FunctionalTests/EFCore.OData.FunctionalTests.csproj" />
7167
<Project Path="test/EFCore.Proxies.Tests/EFCore.Proxies.Tests.csproj" />
7268
<Project Path="test/EFCore.Relational.Specification.Tests/EFCore.Relational.Specification.Tests.csproj" />
7369
<Project Path="test/EFCore.Relational.Tests/EFCore.Relational.Tests.csproj" />
7470
<Project Path="test/EFCore.Specification.Tests/EFCore.Specification.Tests.csproj" />
7571
<Project Path="test/EFCore.Sqlite.FunctionalTests/EFCore.Sqlite.FunctionalTests.csproj" />
7672
<Project Path="test/EFCore.Sqlite.Tests/EFCore.Sqlite.Tests.csproj" />
77-
<Project Path="test/EFCore.SqlServer.FunctionalTests/EFCore.SqlServer.FunctionalTests.csproj" />
78-
<Project Path="test/EFCore.SqlServer.HierarchyId.Tests/EFCore.SqlServer.HierarchyId.Tests.csproj" />
79-
<Project Path="test/EFCore.SqlServer.Tests/EFCore.SqlServer.Tests.csproj" />
8073
<Project Path="test/EFCore.Tests/EFCore.Tests.csproj" />
8174
<Project Path="test/EFCore.VisualBasic.FunctionalTests/EFCore.VisualBasic.FunctionalTests.vbproj" />
8275
<Project Path="test/Microsoft.Data.Sqlite.Tests/Microsoft.Data.Sqlite.sqlite3.Tests.csproj" />

eng/Versions.props

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,7 @@
5252
<OpenTelemetryExporterInMemoryVersion>1.15.1</OpenTelemetryExporterInMemoryVersion>
5353
<SQLitePCLRawVersion>3.0.3</SQLitePCLRawVersion>
5454
<SQLite3MCPCLRawBundleVersion>2.3.2</SQLite3MCPCLRawBundleVersion>
55-
<!-- xUnit v3: override the Arcade SDK defaults (currently XUnitV3Version=3.2.2) so we run on the
56-
requested 4.0.0-pre.108 build. xunit.runner.visualstudio is bumped to a v3-aware build for
57-
the rare projects that opt out of MTP. -->
5855
<XUnitV3Version>4.0.0-pre.108</XUnitV3Version>
59-
<XUnitRunnerVisualStudioVersion>3.1.5</XUnitRunnerVisualStudioVersion>
60-
<!-- Arcade does not provide a default for the v3 extensions package; pinned manually. -->
6156
<MicrosoftDotNetXUnitV3ExtensionsVersion>11.0.0-beta.26263.112</MicrosoftDotNetXUnitV3ExtensionsVersion>
6257
</PropertyGroup>
6358

test/Directory.Build.props

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,8 @@
88
<NuGetAudit>false</NuGetAudit>
99
</PropertyGroup>
1010

11-
<!-- Use the Arcade SDK XUnitV3 test runner stack (xunit.v3 + Microsoft.Testing.Platform) for
12-
executable test projects. xUnit v3 requires test projects to be stand-alone executables;
13-
Microsoft.Testing.Platform.MSBuild handles the OutputType=Exe switch via
14-
IsTestingPlatformApplication, but setting it explicitly here keeps things obvious. -->
1511
<PropertyGroup Condition="'$(IsUnitTestProject)' == 'true'">
1612
<TestRunnerName>XUnitV3</TestRunnerName>
17-
<OutputType>Exe</OutputType>
1813
</PropertyGroup>
1914

2015
</Project>

test/Directory.Packages.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
<PackageVersion Include="SQLitePCLRaw.provider.sqlite3" Version="$(SQLitePCLRawVersion)" />
2323
<PackageVersion Include="SQLitePCLRaw.provider.winsqlite3" Version="$(SQLitePCLRawVersion)" />
2424
<PackageVersion Include="Testcontainers.CosmosDb" Version="4.11.0" />
25-
<!-- xUnit v3 packages whose versions are not implicitly defined by the Arcade SDK XUnitV3 targets. -->
2625
<PackageVersion Include="Microsoft.DotNet.XUnitV3Extensions" Version="$(MicrosoftDotNetXUnitV3ExtensionsVersion)" />
2726
<PackageVersion Include="xunit.v3.assert.aot" Version="$(XUnitV3Version)" />
2827
<PackageVersion Include="xunit.v3.runner.inproc.console" Version="$(XUnitV3Version)" />

test/EFCore.Analyzers.Tests/InternalUsageDiagnosticAnalyzerTests.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using Microsoft.CodeAnalysis;
@@ -9,7 +9,7 @@ namespace Microsoft.EntityFrameworkCore;
99

1010
public class InternalUsageDiagnosticAnalyzerTests
1111
{
12-
[ConditionalFact]
12+
[Fact]
1313
public Task Invocation_on_type_in_internal_namespace()
1414
=> VerifySingleInternalUsageAsync(
1515
"""
@@ -25,7 +25,7 @@ void M()
2525
}
2626
""", "Microsoft.EntityFrameworkCore.Internal.MethodInfoExtensions");
2727

28-
[ConditionalFact]
28+
[Fact]
2929
public Task Instantiation_on_type_in_internal_namespace()
3030
=> VerifySingleInternalUsageAsync(
3131
"""
@@ -38,7 +38,7 @@ void M()
3838
}
3939
""", "Microsoft.EntityFrameworkCore.Infrastructure.Internal.CoreSingletonOptions");
4040

41-
[ConditionalFact]
41+
[Fact]
4242
public async Task Base_type()
4343
{
4444
var source = """
@@ -62,7 +62,7 @@ await VerifyCS.VerifyAnalyzerAsync(
6262
.WithArguments("Microsoft.EntityFrameworkCore.Storage.Internal.RawRelationalParameter"));
6363
}
6464

65-
[ConditionalFact]
65+
[Fact]
6666
public Task Implemented_interface()
6767
=> VerifySingleInternalUsageAsync(
6868
"""
@@ -77,7 +77,7 @@ class {|#0:MyClass|} : IDbSetSource
7777
}
7878
""", "Microsoft.EntityFrameworkCore.Internal.IDbSetSource");
7979

80-
[ConditionalFact]
80+
[Fact]
8181
public Task Access_property_with_internal_attribute()
8282
=> VerifySingleInternalUsageAsync(
8383
"""
@@ -90,7 +90,7 @@ void M()
9090
}
9191
""", "Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkRelationalServicesBuilder.RelationalServices");
9292

93-
[ConditionalFact]
93+
[Fact]
9494
public Task Instantiation_with_ctor_with_internal_attribute()
9595
=> VerifySingleInternalUsageAsync(
9696
"""
@@ -103,7 +103,7 @@ void M()
103103
}
104104
""", "Microsoft.EntityFrameworkCore.Update.UpdateSqlGeneratorDependencies");
105105

106-
[ConditionalFact]
106+
[Fact]
107107
public Task Local_variable_declaration()
108108
=> VerifySingleInternalUsageAsync(
109109
"""
@@ -116,7 +116,7 @@ void M()
116116
}
117117
""", "Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IStateManager");
118118

119-
[ConditionalFact]
119+
[Fact]
120120
public Task Generic_type_parameter_in_method_call()
121121
=> VerifySingleInternalUsageAsync(
122122
"""
@@ -131,7 +131,7 @@ void SomeGenericMethod<T>() {}
131131
}
132132
""", "Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IStateManager");
133133

134-
[ConditionalFact]
134+
[Fact]
135135
public Task Typeof()
136136
=> VerifySingleInternalUsageAsync(
137137
"""
@@ -144,7 +144,7 @@ void M()
144144
}
145145
""", "Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IStateManager");
146146

147-
[ConditionalFact]
147+
[Fact]
148148
public Task Field_declaration()
149149
=> VerifySingleInternalUsageAsync(
150150
"""
@@ -154,7 +154,7 @@ class MyClass
154154
}
155155
""", "Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IStateManager");
156156

157-
[ConditionalFact]
157+
[Fact]
158158
public Task Property_declaration()
159159
=> VerifySingleInternalUsageAsync(
160160
"""
@@ -164,7 +164,7 @@ class MyClass
164164
}
165165
""", "Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IStateManager");
166166

167-
[ConditionalFact]
167+
[Fact]
168168
public Task Method_declaration_return_type()
169169
=> VerifySingleInternalUsageAsync(
170170
"""
@@ -174,7 +174,7 @@ class MyClass
174174
}
175175
""", "Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IStateManager");
176176

177-
[ConditionalFact]
177+
[Fact]
178178
public Task Method_declaration_parameter()
179179
=> VerifySingleInternalUsageAsync(
180180
"""
@@ -184,7 +184,7 @@ private void Foo({|#0:Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ISta
184184
}
185185
""", "Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IStateManager");
186186

187-
[ConditionalFact]
187+
[Fact]
188188
public Task No_warning_on_non_internal()
189189
=> VerifyCS.VerifyAnalyzerAsync(
190190
"""
@@ -198,7 +198,7 @@ void M()
198198
}
199199
""");
200200

201-
[ConditionalFact]
201+
[Fact]
202202
public Task No_warning_in_same_assembly()
203203
=> VerifyCS.VerifyAnalyzerAsync(
204204
"""

test/EFCore.Analyzers.Tests/UninitializedDbSetDiagnosticSuppressorTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Microsoft.EntityFrameworkCore;
99

1010
public class UninitializedDbSetDiagnosticSuppressorTests
1111
{
12-
[ConditionalFact]
12+
[Fact]
1313
public Task DbSet_property_on_DbContext_is_suppressed()
1414
=> VerifySingleSuppressionAsync(
1515
"""
@@ -24,7 +24,7 @@ public class Blog
2424
}
2525
""");
2626

27-
[ConditionalFact]
27+
[Fact]
2828
public Task Non_public_DbSet_property_on_DbContext_is_suppressed()
2929
=> VerifySingleSuppressionAsync(
3030
"""
@@ -39,7 +39,7 @@ public class Blog
3939
}
4040
""");
4141

42-
[ConditionalFact]
42+
[Fact]
4343
public Task DbSet_property_with_non_public_setter_on_DbContext_is_suppressed()
4444
=> VerifySingleSuppressionAsync(
4545
"""
@@ -54,7 +54,7 @@ public class Blog
5454
}
5555
""");
5656

57-
[ConditionalFact]
57+
[Fact]
5858
public Task DbSet_property_without_setter_on_DbContext_is_not_suppressed()
5959
=> VerifySingleSuppressionAsync(
6060
"""
@@ -69,7 +69,7 @@ public class Blog
6969
}
7070
""", isSuppressed: false);
7171

72-
[ConditionalFact]
72+
[Fact]
7373
public Task Static_DbSet_property_on_DbContext_is_not_suppressed()
7474
=> VerifySingleSuppressionAsync(
7575
"""
@@ -84,7 +84,7 @@ public class Blog
8484
}
8585
""", isSuppressed: false);
8686

87-
[ConditionalFact]
87+
[Fact]
8888
public Task Non_DbSet_property_on_DbContext_is_not_suppressed()
8989
=> VerifySingleSuppressionAsync(
9090
"""
@@ -94,7 +94,7 @@ public class MyDbContext : Microsoft.EntityFrameworkCore.DbContext
9494
}
9595
""", isSuppressed: false);
9696

97-
[ConditionalFact]
97+
[Fact]
9898
public Task DbSet_property_on_non_DbContext_is_not_suppressed()
9999
=> VerifySingleSuppressionAsync(
100100
"""
@@ -109,7 +109,7 @@ public class Blog
109109
}
110110
""", isSuppressed: false);
111111

112-
[ConditionalFact]
112+
[Fact]
113113
public async Task DbSet_property_on_DbContext_with_ctor_is_suppressed()
114114
{
115115
var source = """
@@ -140,7 +140,7 @@ public class Blog
140140
}.RunAsync();
141141
}
142142

143-
[ConditionalFact]
143+
[Fact]
144144
public async Task DbSet_property_on_DbContext_with_ctors_is_suppressed()
145145
{
146146
var source = """

test/EFCore.AspNet.InMemory.FunctionalTests/AppServiceProviderFactoryTest.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using Microsoft.EntityFrameworkCore.Design.Internal;
55
using Microsoft.EntityFrameworkCore.Internal;
6-
using Microsoft.EntityFrameworkCore.TestUtilities.Xunit;
7-
86
namespace Microsoft.EntityFrameworkCore;
97

108
public class AppServiceProviderFactoryTest
119
{
12-
[ConditionalFact]
10+
[Fact]
1311
public void Create_services_from_template_method()
1412
{
1513
TestCreateServices(typeof(ProgramWithBuildWebHost));
@@ -57,8 +55,7 @@ public static TestWebHostBuilder CreateHostBuilder(string[] args)
5755
}
5856
}
5957

60-
[ConditionalFact]
61-
[PlatformSkipCondition(TestUtilities.Xunit.TestPlatform.Mac)]
58+
[Fact, SkipOnPlatform(TestPlatforms.OSX, "Test does not run on macOS")]
6259
public void Create_with_no_builder_method()
6360
{
6461
var factory = new TestAppServiceProviderFactory(
@@ -95,7 +92,7 @@ private static ServiceProvider BuildTestServiceProvider()
9592

9693
private class TestService;
9794

98-
[ConditionalFact]
95+
[Fact]
9996
public void Create_works_when_no_BuildWebHost()
10097
{
10198
var factory = new TestAppServiceProviderFactory(
@@ -108,7 +105,7 @@ public void Create_works_when_no_BuildWebHost()
108105

109106
private class ProgramWithoutBuildWebHost;
110107

111-
[ConditionalFact]
108+
[Fact]
112109
public void Create_works_when_BuildWebHost_throws()
113110
{
114111
var reporter = new TestOperationReporter();

0 commit comments

Comments
 (0)