1818using Xunit . Abstractions ;
1919
2020#pragma warning disable SA1401 // Fields should be private
21+ #pragma warning disable SA1414 // Tuple types in signatures should have element names
2122
2223public class MultiplexingStreamTests : TestBase , IAsyncLifetime
2324{
@@ -60,17 +61,15 @@ public async Task InitializeAsync()
6061 this . mx2 = await mx2 ;
6162 }
6263
63- public Task DisposeAsync ( )
64+ public async Task DisposeAsync ( )
6465 {
65- this . mx1 ? . Dispose ( ) ;
66- this . mx2 ? . Dispose ( ) ;
66+ await ( this . mx1 ? . DisposeAsync ( ) ?? default ) ;
67+ await ( this . mx2 ? . DisposeAsync ( ) ?? default ) ;
6768 AssertNoFault ( this . mx1 ) ;
6869 AssertNoFault ( this . mx2 ) ;
6970
7071 this . mx1 ? . TraceSource . Listeners . OfType < XunitTraceListener > ( ) . SingleOrDefault ( ) ? . Dispose ( ) ;
7172 this . mx2 ? . TraceSource . Listeners . OfType < XunitTraceListener > ( ) . SingleOrDefault ( ) ? . Dispose ( ) ;
72-
73- return Task . CompletedTask ;
7473 }
7574
7675 [ Fact ]
@@ -180,24 +179,24 @@ public async Task Dispose_CancelsOutstandingOperations()
180179 {
181180 Task offer = this . mx1 . OfferChannelAsync ( "offer" ) ;
182181 Task accept = this . mx1 . AcceptChannelAsync ( "accept" ) ;
183- this . mx1 . Dispose ( ) ;
182+ await this . mx1 . DisposeAsync ( ) ;
184183 await Assert . ThrowsAnyAsync < OperationCanceledException > ( ( ) => Task . WhenAll ( offer , accept ) ) . WithCancellation ( this . TimeoutToken ) ;
185184 Assert . True ( offer . IsCanceled ) ;
186185 Assert . True ( accept . IsCanceled ) ;
187186 }
188187
189188 [ Fact ]
190- public void Disposal_DisposesTransportStream ( )
189+ public async Task Disposal_DisposesTransportStream ( )
191190 {
192- this . mx1 . Dispose ( ) ;
191+ await this . mx1 . DisposeAsync ( ) ;
193192 Assert . Throws < ObjectDisposedException > ( ( ) => this . transport1 . Position ) ;
194193 }
195194
196195 [ Fact ]
197196 public async Task Dispose_DisposesChannels ( )
198197 {
199198 var ( channel1 , channel2 ) = await this . EstablishChannelsAsync ( "A" ) ;
200- this . mx1 . Dispose ( ) ;
199+ await this . mx1 . DisposeAsync ( ) ;
201200 Assert . True ( channel1 . IsDisposed ) ;
202201 await channel1 . Completion . WithCancellation ( this . TimeoutToken ) ;
203202#pragma warning disable CS0618 // Type or member is obsolete
@@ -209,21 +208,21 @@ public async Task Dispose_DisposesChannels()
209208 [ Fact ]
210209 public async Task CreateChannelAsync_ThrowsAfterDisposal ( )
211210 {
212- this . mx1 . Dispose ( ) ;
211+ await this . mx1 . DisposeAsync ( ) ;
213212 await Assert . ThrowsAsync < ObjectDisposedException > ( ( ) => this . mx1 . OfferChannelAsync ( string . Empty , this . TimeoutToken ) ) . WithCancellation ( this . TimeoutToken ) ;
214213 }
215214
216215 [ Fact ]
217216 public async Task AcceptChannelAsync_ThrowsAfterDisposal ( )
218217 {
219- this . mx1 . Dispose ( ) ;
218+ await this . mx1 . DisposeAsync ( ) ;
220219 await Assert . ThrowsAsync < ObjectDisposedException > ( ( ) => this . mx1 . AcceptChannelAsync ( string . Empty , this . TimeoutToken ) ) . WithCancellation ( this . TimeoutToken ) ;
221220 }
222221
223222 [ Fact ]
224- public void Completion_CompletedAfterDisposal ( )
223+ public async Task Completion_CompletedAfterDisposal ( )
225224 {
226- this . mx1 . Dispose ( ) ;
225+ await this . mx1 . DisposeAsync ( ) ;
227226 Assert . Equal ( TaskStatus . RanToCompletion , this . mx1 . Completion . Status ) ;
228227 }
229228
0 commit comments