Skip to content
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
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<PackageVersion Include="coverlet.collector" Version="6.0.4"/>
<PackageVersion Include="Dapper" Version="2.1.66"/>
<PackageVersion Include="ReflectionMagic" Version="5.0.1"/>
<PackageVersion Include="xunit.analyzers" Version="1.21.0"/>
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2"/>
<PackageVersion Include="xunit" Version="2.9.3"/>
<PackageVersion Include="xunit.v3" Version="2.0.1"/>
Expand Down
12 changes: 10 additions & 2 deletions src/Testcontainers.Xunit/ContainerLifetime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,16 @@ protected virtual TBuilderEntity Configure(TBuilderEntity builder)
return builder;
}

/// <inheritdoc cref="IAsyncLifetime" />
/// <inheritdoc cref="IAsyncLifetime.InitializeAsync" />
protected virtual async LifetimeTask InitializeAsync()
{
try
{
#if XUNIT_V3
await Container.StartAsync(TestContext.Current.CancellationToken)
#else
await Container.StartAsync()
#endif
.ConfigureAwait(false);
}
catch (Exception e)
Expand All @@ -85,7 +89,11 @@ await Container.StartAsync()
}
}

/// <inheritdoc cref="IAsyncLifetime" />
#if XUNIT_V3
/// <inheritdoc cref="IAsyncDisposable.DisposeAsync" />
#else
/// <inheritdoc cref="IAsyncLifetime.DisposeAsync" />
#endif
protected virtual async LifetimeTask DisposeAsyncCore()
{
if (_exception == null)
Expand Down
1 change: 1 addition & 0 deletions src/Testcontainers.Xunit/Testcontainers.Xunit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" VersionOverride="2023.3.0" PrivateAssets="All"/>
<PackageReference Include="xunit.analyzers" PrivateAssets="all"/>
<PackageReference Include="xunit.extensibility.execution"/>
</ItemGroup>
<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Testcontainers.XunitV3/Testcontainers.XunitV3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" VersionOverride="2023.3.0" PrivateAssets="All"/>
<PackageReference Include="xunit.analyzers" PrivateAssets="all"/>
<PackageReference Include="xunit.v3.extensibility.core"/>
</ItemGroup>
<ItemGroup>
Expand Down