Skip to content

Commit 2a64b17

Browse files
chore: Update test-framework to xUnit.net v3 (#1441)
Co-authored-by: Andre Hofmeister <[email protected]>
1 parent 26dbdcc commit 2a64b17

File tree

163 files changed

+710
-583
lines changed

Some content is hidden

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

163 files changed

+710
-583
lines changed

Directory.Packages.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
<PackageVersion Include="Dapper" Version="2.1.66"/>
2020
<PackageVersion Include="ReflectionMagic" Version="5.0.1"/>
2121
<PackageVersion Include="xunit.analyzers" Version="1.21.0"/>
22-
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2"/>
22+
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.0"/>
2323
<PackageVersion Include="xunit" Version="2.9.3"/>
24-
<PackageVersion Include="xunit.v3" Version="2.0.1"/>
24+
<PackageVersion Include="xunit.v3" Version="2.0.2"/>
2525
<!-- xUnit.net extensibility for Testcontainers.Xunit and Testcontainers.XunitV3 packages: -->
2626
<PackageVersion Include="xunit.extensibility.execution" Version="2.9.3"/>
27-
<PackageVersion Include="xunit.v3.extensibility.core" Version="1.1.0"/>
27+
<PackageVersion Include="xunit.v3.extensibility.core" Version="2.0.2"/>
2828
<!-- Third-party client dependencies to connect and interact with the containers: -->
2929
<PackageVersion Include="Apache.NMS.ActiveMQ" Version="2.1.1"/>
3030
<PackageVersion Include="ArangoDBNetStandard" Version="2.0.1"/>

src/Testcontainers.FirebirdSql/FirebirdSqlConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public FirebirdSqlConfiguration(FirebirdSqlConfiguration oldValue, FirebirdSqlCo
6868
/// <summary>
6969
/// Gets the FirebirdSql database.
7070
/// </summary>
71-
public string Database => Image.Tag.StartsWith("2.5") || Image.Tag.StartsWith("v2.5") ? string.Join("/", "/firebird/data", _database) : _database;
71+
public string Database => Image.Tag != null && (Image.Tag.StartsWith("2.5") || Image.Tag.StartsWith("v2.5")) ? string.Join("/", "/firebird/data", _database) : _database;
7272

7373
/// <summary>
7474
/// Gets the FirebirdSql username.

src/Testcontainers.Xunit/Testcontainers.Xunit.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</PropertyGroup>
66
<ItemGroup>
77
<PackageReference Include="JetBrains.Annotations" VersionOverride="2023.3.0" PrivateAssets="All"/>
8-
<PackageReference Include="xunit.analyzers" PrivateAssets="all"/>
8+
<PackageReference Include="xunit.analyzers" PrivateAssets="All"/>
99
<PackageReference Include="xunit.extensibility.execution"/>
1010
</ItemGroup>
1111
<ItemGroup>

src/Testcontainers.XunitV3/Testcontainers.XunitV3.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77
<ItemGroup>
88
<PackageReference Include="JetBrains.Annotations" VersionOverride="2023.3.0" PrivateAssets="All"/>
9-
<PackageReference Include="xunit.analyzers" PrivateAssets="all"/>
9+
<PackageReference Include="xunit.analyzers" PrivateAssets="All"/>
1010
<PackageReference Include="xunit.v3.extensibility.core"/>
1111
</ItemGroup>
1212
<ItemGroup>

src/Testcontainers/Clients/TestcontainersClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ internal sealed class TestcontainersClient : ITestcontainersClient
3030

3131
public const string TestcontainersReuseHashLabel = TestcontainersLabel + ".reuse-hash";
3232

33-
public static readonly string Version = typeof(TestcontainersClient).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
33+
public static readonly string Version = typeof(TestcontainersClient).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()!.InformationalVersion;
3434

3535
private static readonly string OSRootDirectory = Path.GetPathRoot(Directory.GetCurrentDirectory());
3636

tests/Testcontainers.ActiveMq.Tests/ArtemisContainerTest.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ private ArtemisContainerTest(ArtemisContainer artemisContainer, string username,
1616
_password = password;
1717
}
1818

19-
public Task InitializeAsync()
19+
public async ValueTask InitializeAsync()
2020
{
21-
return _artemisContainer.StartAsync();
21+
await _artemisContainer.StartAsync()
22+
.ConfigureAwait(false);
2223
}
2324

24-
public Task DisposeAsync()
25+
public ValueTask DisposeAsync()
2526
{
26-
return _artemisContainer.DisposeAsync().AsTask();
27+
return _artemisContainer.DisposeAsync();
2728
}
2829
// # --8<-- [end:UseArtemisContainer]
2930

tests/Testcontainers.ActiveMq.Tests/Testcontainers.ActiveMq.Tests.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
<TargetFrameworks>net9.0</TargetFrameworks>
44
<IsPackable>false</IsPackable>
55
<IsPublishable>false</IsPublishable>
6+
<OutputType>Exe</OutputType>
67
</PropertyGroup>
78
<ItemGroup>
89
<!-- -8<- [start:PackageReferences] -->
910
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
1011
<PackageReference Include="coverlet.collector"/>
1112
<PackageReference Include="xunit.runner.visualstudio"/>
12-
<PackageReference Include="xunit"/>
13+
<PackageReference Include="xunit.v3"/>
1314
<PackageReference Include="Apache.NMS.ActiveMQ"/>
1415
<!-- -8<- [end:PackageReferences] -->
1516
</ItemGroup>

tests/Testcontainers.ArangoDb.Tests/ArangoDbContainerTest.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ public sealed class ArangoDbContainerTest : IAsyncLifetime
44
{
55
private readonly ArangoDbContainer _arangoDbContainer = new ArangoDbBuilder().Build();
66

7-
public Task InitializeAsync()
7+
public async ValueTask InitializeAsync()
88
{
9-
return _arangoDbContainer.StartAsync();
9+
await _arangoDbContainer.StartAsync()
10+
.ConfigureAwait(false);
1011
}
1112

12-
public Task DisposeAsync()
13+
public ValueTask DisposeAsync()
1314
{
14-
return _arangoDbContainer.DisposeAsync().AsTask();
15+
return _arangoDbContainer.DisposeAsync();
1516
}
1617

1718
[Fact]
@@ -26,7 +27,7 @@ public async Task RetrievesDatabases()
2627
using var client = new ArangoDBClient(transport);
2728

2829
// When
29-
var response = await client.Database.GetDatabasesAsync()
30+
var response = await client.Database.GetDatabasesAsync(TestContext.Current.CancellationToken)
3031
.ConfigureAwait(true);
3132

3233
// Then

tests/Testcontainers.ArangoDb.Tests/Testcontainers.ArangoDb.Tests.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
<TargetFrameworks>net9.0</TargetFrameworks>
44
<IsPackable>false</IsPackable>
55
<IsPublishable>false</IsPublishable>
6+
<OutputType>Exe</OutputType>
67
</PropertyGroup>
78
<ItemGroup>
89
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
910
<PackageReference Include="coverlet.collector"/>
1011
<PackageReference Include="xunit.runner.visualstudio"/>
11-
<PackageReference Include="xunit"/>
12+
<PackageReference Include="xunit.v3"/>
1213
<PackageReference Include="ArangoDBNetStandard"/>
1314
</ItemGroup>
1415
<ItemGroup>

tests/Testcontainers.Azurite.Tests/AzuriteContainerTest.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ private AzuriteContainerTest(AzuriteContainer azuriteContainer)
99
_azuriteContainer = azuriteContainer;
1010
}
1111

12-
public Task InitializeAsync()
12+
public async ValueTask InitializeAsync()
1313
{
14-
return _azuriteContainer.StartAsync();
14+
await _azuriteContainer.StartAsync()
15+
.ConfigureAwait(false);
1516
}
1617

17-
public Task DisposeAsync()
18+
public ValueTask DisposeAsync()
1819
{
19-
return _azuriteContainer.DisposeAsync().AsTask();
20+
return _azuriteContainer.DisposeAsync();
2021
}
2122

2223
[Fact]
@@ -27,7 +28,7 @@ public async Task EstablishesBlobServiceConnection()
2728
var client = new BlobServiceClient(_azuriteContainer.GetConnectionString());
2829

2930
// When
30-
var properties = await client.GetPropertiesAsync()
31+
var properties = await client.GetPropertiesAsync(TestContext.Current.CancellationToken)
3132
.ConfigureAwait(true);
3233

3334
// Then
@@ -42,7 +43,7 @@ public async Task EstablishesQueueServiceConnection()
4243
var client = new QueueServiceClient(_azuriteContainer.GetConnectionString());
4344

4445
// When
45-
var properties = await client.GetPropertiesAsync()
46+
var properties = await client.GetPropertiesAsync(TestContext.Current.CancellationToken)
4647
.ConfigureAwait(true);
4748

4849
// Then
@@ -57,7 +58,7 @@ public async Task EstablishesTableServiceConnection()
5758
var client = new TableServiceClient(_azuriteContainer.GetConnectionString());
5859

5960
// When
60-
var properties = await client.GetPropertiesAsync()
61+
var properties = await client.GetPropertiesAsync(TestContext.Current.CancellationToken)
6162
.ConfigureAwait(true);
6263

6364
// Then
@@ -106,7 +107,7 @@ public AzuriteMemoryLimitConfiguration()
106107
public async Task MemoryLimitIsConfigured()
107108
{
108109
// Given
109-
var (stdout, _) = await _azuriteContainer.GetLogsAsync(timestampsEnabled: false)
110+
var (stdout, _) = await _azuriteContainer.GetLogsAsync(timestampsEnabled: false, ct: TestContext.Current.CancellationToken)
110111
.ConfigureAwait(true);
111112

112113
// When

0 commit comments

Comments
 (0)