File tree Expand file tree Collapse file tree 3 files changed +26
-8
lines changed Expand file tree Collapse file tree 3 files changed +26
-8
lines changed Original file line number Diff line number Diff line change 11using System ;
2+ using System . Threading . Tasks ;
23using Xunit . Abstractions ;
34
45namespace Xunit . Microsoft . DependencyInjection . Abstracts
56{
6- public abstract class TestBed < TFixture > : IDisposable , IClassFixture < TFixture >
7+ public abstract class TestBed < TFixture > : IDisposable , IClassFixture < TFixture > , IAsyncDisposable
78 where TFixture : class
89 {
910 protected readonly ITestOutputHelper _testOutputHelper ;
@@ -43,6 +44,14 @@ public void Dispose()
4344 GC . SuppressFinalize ( this ) ;
4445 }
4546
46- protected abstract void Clear ( ) ;
47+ protected abstract void Clear ( ) ;
48+
49+ public async ValueTask DisposeAsync ( )
50+ {
51+ await DisposeAsyncCore ( ) ;
52+ GC . SuppressFinalize ( this ) ;
53+ }
54+
55+ protected abstract ValueTask DisposeAsyncCore ( ) ;
4756 }
4857}
Original file line number Diff line number Diff line change 33using Microsoft . Extensions . Logging ;
44using System ;
55using System . IO ;
6+ using System . Threading . Tasks ;
67using Xunit . Abstractions ;
78using Xunit . Microsoft . DependencyInjection . Logging ;
89
910namespace Xunit . Microsoft . DependencyInjection . Abstracts
1011{
11- public abstract class TestBedFixture : IDisposable
12+ public abstract class TestBedFixture : IDisposable , IAsyncDisposable
1213 {
1314 private readonly IServiceCollection _services ;
1415 private IServiceProvider _serviceProvider ;
@@ -94,6 +95,14 @@ public void Dispose()
9495 // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
9596 Dispose ( disposing : true ) ;
9697 GC . SuppressFinalize ( this ) ;
97- }
98+ }
99+
100+ public async ValueTask DisposeAsync ( )
101+ {
102+ await DisposeAsyncCore ( ) ;
103+ GC . SuppressFinalize ( this ) ;
104+ }
105+
106+ protected abstract ValueTask DisposeAsyncCore ( ) ;
98107 }
99108}
Original file line number Diff line number Diff line change 55 </PropertyGroup >
66
77 <ItemGroup >
8- <PackageReference Include =" Microsoft.Extensions.DependencyInjection.Abstractions" Version =" 3.1.9 " />
9- <PackageReference Include =" Microsoft.Extensions.Logging" Version =" 3.1.9 " />
8+ <PackageReference Include =" Microsoft.Extensions.DependencyInjection.Abstractions" Version =" 3.1.10 " />
9+ <PackageReference Include =" Microsoft.Extensions.Logging" Version =" 3.1.10 " />
1010 <PackageReference Include =" xunit.abstractions" Version =" 2.0.3" />
11- <PackageReference Include =" Microsoft.Extensions.Configuration.FileExtensions" Version =" 3.1.9 " />
12- <PackageReference Include =" Microsoft.Extensions.Configuration.Json" Version =" 3.1.9 " />
11+ <PackageReference Include =" Microsoft.Extensions.Configuration.FileExtensions" Version =" 3.1.10 " />
12+ <PackageReference Include =" Microsoft.Extensions.Configuration.Json" Version =" 3.1.10 " />
1313 <PackageReference Include =" xunit.core" Version =" 2.4.1" />
1414 </ItemGroup >
1515 <ItemGroup >
You can’t perform that action at this time.
0 commit comments