File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 77
88namespace UnitTest . Core ;
99
10- public class BootstrapBlazorTestBase : TestBase , IDisposable
10+ public class BootstrapBlazorTestBase : TestBase
1111{
1212 protected ICacheManager Cache { get ; }
1313
@@ -38,12 +38,6 @@ protected virtual void ConfigureConfiguration(IServiceCollection services)
3838 services . AddConfiguration ( ) ;
3939 }
4040
41- public void Dispose ( )
42- {
43- _ = Context . DisposeAsync ( ) ;
44- GC . SuppressFinalize ( this ) ;
45- }
46-
4741 class FooLookupService : LookupServiceBase
4842 {
4943 public override IEnumerable < SelectedItem > ? GetItemsByKey ( string ? key , object ? data )
Original file line number Diff line number Diff line change 55
66namespace UnitTest . Core ;
77
8- public class TestBase
8+ public class TestBase : IDisposable
99{
1010 protected BunitContext Context { get ; }
1111
@@ -16,4 +16,13 @@ public TestBase()
1616
1717 Context . Services . AddMockEnvironment ( ) ;
1818 }
19+
20+ public void Dispose ( )
21+ {
22+ #pragma warning disable CA2012
23+ // 由于 bUnit 2.0 继承了 IAsyncDisposable 接口,因此此处调用 DisposeAsync 方法
24+ Context . DisposeAsync ( ) ;
25+ #pragma warning restore CA2012
26+ GC . SuppressFinalize ( this ) ;
27+ }
1928}
You can’t perform that action at this time.
0 commit comments