@@ -246,9 +246,9 @@ public void ExecuteXmlReaderErrorTest()
246246 [ Fact ]
247247 public void ExecuteScalarAsyncTest ( )
248248 {
249- RemoteExecutor . Invoke ( ( ) =>
249+ RemoteExecutor . Invoke ( async ( ) =>
250250 {
251- CollectStatisticsDiagnosticsAsync ( async connectionString =>
251+ await CollectStatisticsDiagnosticsAsync ( async connectionString =>
252252 {
253253#if NET
254254 await using ( SqlConnection conn = new SqlConnection ( connectionString ) )
@@ -264,17 +264,17 @@ public void ExecuteScalarAsyncTest()
264264 conn . Open ( ) ;
265265 await cmd . ExecuteScalarAsync ( ) ;
266266 }
267- } , [ WriteConnectionOpenBefore , WriteConnectionOpenAfter , WriteCommandBefore , WriteCommandAfter , WriteConnectionCloseBefore , WriteConnectionCloseAfter ] ) . Wait ( ) ;
267+ } , [ WriteConnectionOpenBefore , WriteConnectionOpenAfter , WriteCommandBefore , WriteCommandAfter , WriteConnectionCloseBefore , WriteConnectionCloseAfter ] ) ;
268268 return RemoteExecutor . SuccessExitCode ;
269269 } ) . Dispose ( ) ;
270270 }
271271
272272 [ Fact ]
273273 public void ExecuteScalarAsyncErrorTest ( )
274274 {
275- RemoteExecutor . Invoke ( ( ) =>
275+ RemoteExecutor . Invoke ( async ( ) =>
276276 {
277- CollectStatisticsDiagnosticsAsync ( async connectionString =>
277+ await CollectStatisticsDiagnosticsAsync ( async connectionString =>
278278 {
279279#if NET
280280 await using ( SqlConnection conn = new SqlConnection ( connectionString ) )
@@ -290,17 +290,17 @@ public void ExecuteScalarAsyncErrorTest()
290290 conn . Open ( ) ;
291291 await Assert . ThrowsAsync < SqlException > ( ( ) => cmd . ExecuteScalarAsync ( ) ) ;
292292 }
293- } , [ WriteConnectionOpenBefore , WriteConnectionOpenAfter , WriteCommandBefore , WriteCommandError , WriteConnectionCloseBefore , WriteConnectionCloseAfter ] ) . Wait ( ) ;
293+ } , [ WriteConnectionOpenBefore , WriteConnectionOpenAfter , WriteCommandBefore , WriteCommandError , WriteConnectionCloseBefore , WriteConnectionCloseAfter ] ) ;
294294 return RemoteExecutor . SuccessExitCode ;
295295 } ) . Dispose ( ) ;
296296 }
297297
298298 [ Fact ]
299299 public void ExecuteNonQueryAsyncTest ( )
300300 {
301- RemoteExecutor . Invoke ( ( ) =>
301+ RemoteExecutor . Invoke ( async ( ) =>
302302 {
303- CollectStatisticsDiagnosticsAsync ( async connectionString =>
303+ await CollectStatisticsDiagnosticsAsync ( async connectionString =>
304304 {
305305#if NET
306306 await using ( SqlConnection conn = new SqlConnection ( connectionString ) )
@@ -316,17 +316,17 @@ public void ExecuteNonQueryAsyncTest()
316316 conn . Open ( ) ;
317317 await cmd . ExecuteNonQueryAsync ( ) ;
318318 }
319- } , [ WriteConnectionOpenBefore , WriteConnectionOpenAfter , WriteCommandBefore , WriteCommandAfter , WriteConnectionCloseBefore , WriteConnectionCloseAfter ] ) . Wait ( ) ;
319+ } , [ WriteConnectionOpenBefore , WriteConnectionOpenAfter , WriteCommandBefore , WriteCommandAfter , WriteConnectionCloseBefore , WriteConnectionCloseAfter ] ) ;
320320 return RemoteExecutor . SuccessExitCode ;
321321 } ) . Dispose ( ) ;
322322 }
323323
324324 [ Fact ]
325325 public void ExecuteNonQueryAsyncErrorTest ( )
326326 {
327- RemoteExecutor . Invoke ( ( ) =>
327+ RemoteExecutor . Invoke ( async ( ) =>
328328 {
329- CollectStatisticsDiagnosticsAsync ( async connectionString =>
329+ await CollectStatisticsDiagnosticsAsync ( async connectionString =>
330330 {
331331#if NET
332332 await using ( SqlConnection conn = new SqlConnection ( connectionString ) )
@@ -342,17 +342,17 @@ public void ExecuteNonQueryAsyncErrorTest()
342342 conn . Open ( ) ;
343343 await Assert . ThrowsAsync < SqlException > ( ( ) => cmd . ExecuteNonQueryAsync ( ) ) ;
344344 }
345- } , [ WriteConnectionOpenBefore , WriteConnectionOpenAfter , WriteCommandBefore , WriteCommandError , WriteConnectionCloseBefore , WriteConnectionCloseAfter ] ) . Wait ( ) ;
345+ } , [ WriteConnectionOpenBefore , WriteConnectionOpenAfter , WriteCommandBefore , WriteCommandError , WriteConnectionCloseBefore , WriteConnectionCloseAfter ] ) ;
346346 return RemoteExecutor . SuccessExitCode ;
347347 } ) . Dispose ( ) ;
348348 }
349349
350350 [ Fact ]
351351 public void ExecuteReaderAsyncTest ( )
352352 {
353- RemoteExecutor . Invoke ( ( ) =>
353+ RemoteExecutor . Invoke ( async ( ) =>
354354 {
355- CollectStatisticsDiagnosticsAsync ( async connectionString =>
355+ await CollectStatisticsDiagnosticsAsync ( async connectionString =>
356356 {
357357#if NET
358358 await using ( SqlConnection conn = new SqlConnection ( connectionString ) )
@@ -372,17 +372,17 @@ public void ExecuteReaderAsyncTest()
372372 // Read to end
373373 }
374374 }
375- } , [ WriteConnectionOpenBefore , WriteConnectionOpenAfter , WriteCommandBefore , WriteCommandAfter , WriteConnectionCloseBefore , WriteConnectionCloseAfter ] ) . Wait ( ) ;
375+ } , [ WriteConnectionOpenBefore , WriteConnectionOpenAfter , WriteCommandBefore , WriteCommandAfter , WriteConnectionCloseBefore , WriteConnectionCloseAfter ] ) ;
376376 return RemoteExecutor . SuccessExitCode ;
377377 } ) . Dispose ( ) ;
378378 }
379379
380380 [ Fact ]
381381 public void ExecuteReaderAsyncErrorTest ( )
382382 {
383- RemoteExecutor . Invoke ( ( ) =>
383+ RemoteExecutor . Invoke ( async ( ) =>
384384 {
385- CollectStatisticsDiagnosticsAsync ( async connectionString =>
385+ await CollectStatisticsDiagnosticsAsync ( async connectionString =>
386386 {
387387#if NET
388388 await using ( SqlConnection conn = new SqlConnection ( connectionString ) )
@@ -399,7 +399,7 @@ public void ExecuteReaderAsyncErrorTest()
399399 // @TODO: TestTdsServer should not throw on ExecuteReader, should throw on reader.Read
400400 await Assert . ThrowsAsync < SqlException > ( ( ) => cmd . ExecuteReaderAsync ( ) ) ;
401401 }
402- } , [ WriteConnectionOpenBefore , WriteConnectionOpenAfter , WriteCommandBefore , WriteCommandError , WriteConnectionCloseBefore , WriteConnectionCloseAfter ] ) . Wait ( ) ;
402+ } , [ WriteConnectionOpenBefore , WriteConnectionOpenAfter , WriteCommandBefore , WriteCommandError , WriteConnectionCloseBefore , WriteConnectionCloseAfter ] ) ;
403403 return RemoteExecutor . SuccessExitCode ;
404404 } ) . Dispose ( ) ;
405405 }
@@ -409,9 +409,9 @@ public void ExecuteReaderAsyncErrorTest()
409409 public void ExecuteXmlReaderAsyncTest ( )
410410 {
411411 // @TODO: TestTdsServer does not handle xml reader, so connect to a real server as a workaround
412- RemoteExecutor . Invoke ( ( ) =>
412+ RemoteExecutor . Invoke ( async ( ) =>
413413 {
414- CollectStatisticsDiagnosticsAsync ( async _ =>
414+ await CollectStatisticsDiagnosticsAsync ( async _ =>
415415 {
416416#if NET
417417 await using ( SqlConnection conn = new SqlConnection ( DataTestUtility . TCPConnectionString ) )
@@ -431,7 +431,7 @@ public void ExecuteXmlReaderAsyncTest()
431431 // Read to end
432432 }
433433 }
434- } , [ WriteConnectionOpenBefore , WriteConnectionOpenAfter , WriteCommandBefore , WriteCommandAfter , WriteConnectionCloseBefore , WriteConnectionCloseAfter ] ) . Wait ( ) ;
434+ } , [ WriteConnectionOpenBefore , WriteConnectionOpenAfter , WriteCommandBefore , WriteCommandAfter , WriteConnectionCloseBefore , WriteConnectionCloseAfter ] ) ;
435435 return RemoteExecutor . SuccessExitCode ;
436436 } ) . Dispose ( ) ;
437437 }
@@ -440,10 +440,9 @@ public void ExecuteXmlReaderAsyncTest()
440440 public void ExecuteXmlReaderAsyncErrorTest ( )
441441 {
442442 // @TODO: TestTdsServer does not handle xml reader, so connect to a real server as a workaround
443- RemoteExecutor . Invoke ( ( ) =>
443+ RemoteExecutor . Invoke ( async ( ) =>
444444 {
445-
446- CollectStatisticsDiagnosticsAsync ( async _ =>
445+ await CollectStatisticsDiagnosticsAsync ( async _ =>
447446 {
448447#if NET
449448 await using ( SqlConnection conn = new SqlConnection ( DataTestUtility . TCPConnectionString ) )
@@ -466,7 +465,7 @@ public void ExecuteXmlReaderAsyncErrorTest()
466465 XmlReader reader = await cmd . ExecuteXmlReaderAsync ( ) ;
467466 await Assert . ThrowsAsync < SqlException > ( ( ) => reader . ReadAsync ( ) ) ;
468467 }
469- } , [ WriteConnectionOpenBefore , WriteConnectionOpenAfter , WriteCommandBefore , WriteCommandAfter , WriteConnectionCloseBefore , WriteConnectionCloseAfter ] ) . Wait ( ) ;
468+ } , [ WriteConnectionOpenBefore , WriteConnectionOpenAfter , WriteCommandBefore , WriteCommandAfter , WriteConnectionCloseBefore , WriteConnectionCloseAfter ] ) ;
470469 return RemoteExecutor . SuccessExitCode ;
471470 } ) . Dispose ( ) ;
472471 }
@@ -506,9 +505,9 @@ public void ConnectionOpenErrorTest()
506505 [ Fact ]
507506 public void ConnectionOpenAsyncTest ( )
508507 {
509- RemoteExecutor . Invoke ( ( ) =>
508+ RemoteExecutor . Invoke ( async ( ) =>
510509 {
511- CollectStatisticsDiagnosticsAsync ( async connectionString =>
510+ await CollectStatisticsDiagnosticsAsync ( async connectionString =>
512511 {
513512#if NET
514513 await using ( SqlConnection sqlConnection = new SqlConnection ( connectionString ) )
@@ -518,17 +517,17 @@ public void ConnectionOpenAsyncTest()
518517 {
519518 await sqlConnection . OpenAsync ( ) ;
520519 }
521- } , [ WriteConnectionOpenBefore , WriteConnectionOpenAfter , WriteConnectionCloseBefore , WriteConnectionCloseAfter ] ) . Wait ( ) ;
520+ } , [ WriteConnectionOpenBefore , WriteConnectionOpenAfter , WriteConnectionCloseBefore , WriteConnectionCloseAfter ] ) ;
522521 return RemoteExecutor . SuccessExitCode ;
523522 } ) . Dispose ( ) ;
524523 }
525524
526525 [ Fact ]
527526 public void ConnectionOpenAsyncErrorTest ( )
528527 {
529- RemoteExecutor . Invoke ( ( ) =>
528+ RemoteExecutor . Invoke ( async ( ) =>
530529 {
531- CollectStatisticsDiagnosticsAsync ( async _ =>
530+ await CollectStatisticsDiagnosticsAsync ( async _ =>
532531 {
533532#if NET
534533 await using ( SqlConnection sqlConnection = new SqlConnection ( BadConnectionString ) )
@@ -538,7 +537,7 @@ public void ConnectionOpenAsyncErrorTest()
538537 {
539538 await Assert . ThrowsAsync < SqlException > ( ( ) => sqlConnection . OpenAsync ( ) ) ;
540539 }
541- } , [ WriteConnectionOpenBefore , WriteConnectionOpenError ] ) . Wait ( ) ;
540+ } , [ WriteConnectionOpenBefore , WriteConnectionOpenError ] ) ;
542541 return RemoteExecutor . SuccessExitCode ;
543542 } ) . Dispose ( ) ;
544543 }
0 commit comments