@@ -41,9 +41,8 @@ public async Task CanOpenAndCloseDialogWithShowMethod()
4141
4242 object ? result = await DialogHost . Show ( "Content" , id ,
4343 new DialogOpenedEventHandler ( ( ( sender , args ) => { args . Session . Close ( 42 ) ; } ) ) ) ;
44-
4544 await Assert . That ( result ) . IsEqualTo ( 42 ) ;
46- Assert . False ( _dialogHost . IsOpen ) ;
45+ await Assert . That ( _dialogHost . IsOpen ) . IsFalse ( ) ;
4746 }
4847
4948 [ Test , STAThreadExecutor ]
@@ -54,9 +53,8 @@ public async Task CanOpenDialogWithShowMethodAndCloseWithIsOpen()
5453
5554 object ? result = await DialogHost . Show ( "Content" , id ,
5655 new DialogOpenedEventHandler ( ( ( sender , args ) => { _dialogHost . IsOpen = false ; } ) ) ) ;
57-
58- Assert . Null ( result ) ;
59- Assert . False ( _dialogHost . IsOpen ) ;
56+ await Assert . That ( result ) . IsNull ( ) ;
57+ await Assert . That ( _dialogHost . IsOpen ) . IsFalse ( ) ;
6058 }
6159
6260 [ Test , STAThreadExecutor ]
@@ -65,13 +63,13 @@ public async Task CanCloseDialogWithRoutedEvent()
6563 Guid closeParameter = Guid . NewGuid ( ) ;
6664 Task < object ? > showTask = _dialogHost . ShowDialog ( "Content" ) ;
6765 DialogSession ? session = _dialogHost . CurrentSession ;
68- Assert . False ( session ? . IsEnded ) ;
66+ await Assert . That ( session ? . IsEnded ) . IsFalse ( ) ;
6967
7068 DialogHost . CloseDialogCommand . Execute ( closeParameter , _dialogHost ) ;
7169
72- Assert . False ( _dialogHost . IsOpen ) ;
73- Assert . Null ( _dialogHost . CurrentSession ) ;
74- Assert . True ( session ? . IsEnded ) ;
70+ await Assert . That ( _dialogHost . IsOpen ) . IsFalse ( ) ;
71+ await Assert . That ( _dialogHost . CurrentSession ) . IsNull ( ) ;
72+ await Assert . That ( session ? . IsEnded ) . IsTrue ( ) ;
7573 await Assert . That ( await showTask ) . IsEqualTo ( closeParameter ) ;
7674 }
7775
@@ -82,11 +80,11 @@ public async Task DialogHostExposesSessionAsProperty()
8280 _dialogHost . Identifier = id ;
8381
8482 await DialogHost . Show ( "Content" , id ,
85- new DialogOpenedEventHandler ( ( ( sender , args ) =>
83+ new DialogOpenedEventHandler ( async ( sender , args ) =>
8684 {
87- Assert . True ( ReferenceEquals ( args . Session , _dialogHost . CurrentSession ) ) ;
85+ await Assert . That ( ReferenceEquals ( args . Session , _dialogHost . CurrentSession ) ) . IsTrue ( ) ;
8886 args . Session . Close ( ) ;
89- } ) ) ) ;
87+ } ) ) ;
9088 }
9189
9290 [ Test , STAThreadExecutor ]
@@ -242,12 +240,12 @@ public async Task WhenDoubleClickAwayDialogCloses()
242240
243241 [ Test , STAThreadExecutor ]
244242 [ Description ( "Issue 1618" ) ]
245- public void WhenDialogHostIsUnloadedIsOpenRemainsTrue ( )
243+ public async Task WhenDialogHostIsUnloadedIsOpenRemainsTrue ( )
246244 {
247245 _dialogHost . IsOpen = true ;
248246 _dialogHost . RaiseEvent ( new RoutedEventArgs ( FrameworkElement . UnloadedEvent ) ) ;
249247
250- Assert . True ( _dialogHost . IsOpen ) ;
248+ await Assert . That ( _dialogHost . IsOpen ) . IsTrue ( ) ;
251249 }
252250
253251 [ Test , STAThreadExecutor ]
@@ -297,7 +295,7 @@ public async Task WhenClosingDialogReturnValueCanBeSpecifiedInClosedEventHandler
297295
298296 [ Test , STAThreadExecutor ]
299297 [ Description ( "Pull Request 2029" ) ]
300- public void WhenClosingDialogItThrowsWhenNoInstancesLoaded ( )
298+ public async Task WhenClosingDialogItThrowsWhenNoInstancesLoaded ( )
301299 {
302300 _dialogHost . RaiseEvent ( new RoutedEventArgs ( FrameworkElement . UnloadedEvent ) ) ;
303301
@@ -307,23 +305,23 @@ public void WhenClosingDialogItThrowsWhenNoInstancesLoaded()
307305
308306 [ Test , STAThreadExecutor ]
309307 [ Description ( "Pull Request 2029" ) ]
310- public void WhenClosingDialogWithInvalidIdentifierItThrowsWhenNoMatchingInstances ( )
308+ public async Task WhenClosingDialogWithInvalidIdentifierItThrowsWhenNoMatchingInstances ( )
311309 {
312310 object id = Guid . NewGuid ( ) ;
313311 var ex = Assert . Throws < InvalidOperationException > ( ( ) => DialogHost . Close ( id ) ) ;
314- await Assert . That ( ex . Message ) . IsEqualTo ( $ "No loaded DialogHost have an Identifier property matching dialogIdentifier ('{ id } ') argument.") ;
312+ await Assert . That ( ex . Message ) . IsEqualTo ( "No loaded DialogHost have an Identifier property matching dialogIdentifier ('{id}') argument." ) ;
315313 }
316314
317315 [ Test , STAThreadExecutor ]
318316 [ Description ( "Pull Request 2029" ) ]
319- public void WhenClosingDialogWithMultipleDialogHostsItThrowsTooManyMatchingInstances ( )
317+ public async Task WhenClosingDialogWithMultipleDialogHostsItThrowsTooManyMatchingInstances ( )
320318 {
321319 var secondInstance = new DialogHost ( ) ;
322320 try
323321 {
324322 secondInstance . RaiseEvent ( new RoutedEventArgs ( FrameworkElement . LoadedEvent ) ) ;
325323 var ex = Assert . Throws < InvalidOperationException > ( ( ) => DialogHost . Close ( null ! ) ) ;
326- await Assert . That ( especially where multiple Windows are a concern . " , ex . Message ) . IsEqualTo ( "Multiple viable DialogHosts. Specify a unique Identifier on each DialogHost);
324+ await Assert . That ( ex . Message ) . IsEqualTo ( "Multiple viable DialogHosts. Specify a unique Identifier on each DialogHost especially where multiple Windows are a concern." ) ;
327325 }
328326 finally
329327 {
@@ -333,15 +331,15 @@ public void WhenClosingDialogWithMultipleDialogHostsItThrowsTooManyMatchingInsta
333331
334332 [ Test , STAThreadExecutor ]
335333 [ Description ( "Pull Request 2029" ) ]
336- public void WhenClosingDialogThatIsNotOpenItThrowsDialogNotOpen ( )
334+ public async Task WhenClosingDialogThatIsNotOpenItThrowsDialogNotOpen ( )
337335 {
338336 var ex = Assert . Throws < InvalidOperationException > ( ( ) => DialogHost . Close ( null ! ) ) ;
339337 await Assert . That ( ex . Message ) . IsEqualTo ( "DialogHost is not open." ) ;
340338 }
341339
342340 [ Test , STAThreadExecutor ]
343341 [ Description ( "Pull Request 2029" ) ]
344- public void WhenClosingDialogWithParameterItPassesParameterToHandlers ( )
342+ public async Task WhenClosingDialogWithParameterItPassesParameterToHandlers ( )
345343 {
346344 object parameter = Guid . NewGuid ( ) ;
347345 object ? closingParameter = null ;
@@ -367,18 +365,18 @@ void DialogClosed(object sender, DialogClosedEventArgs eventArgs)
367365 }
368366
369367 [ Test , STAThreadExecutor ]
370- public void WhenOpenDialogsAreOpenIsExist ( )
368+ public async Task WhenOpenDialogsAreOpenIsExist ( )
371369 {
372370 object id = Guid . NewGuid ( ) ;
373371 _dialogHost . Identifier = id ;
374372 bool isExist = false ;
375- _ = _dialogHost . ShowDialog ( "Content" , new DialogOpenedEventHandler ( ( sender , arg ) =>
373+ await _dialogHost . ShowDialog ( "Content" , new DialogOpenedEventHandler ( ( sender , arg ) =>
376374 {
377375 isExist = DialogHost . IsDialogOpen ( id ) ;
378376 } ) ) ;
379- Assert . True ( isExist ) ;
377+ await Assert . That ( isExist ) . IsTrue ( ) ;
380378 DialogHost . Close ( id ) ;
381- Assert . False ( DialogHost . IsDialogOpen ( id ) ) ;
379+ await Assert . That ( DialogHost . IsDialogOpen ( id ) ) . IsFalse ( ) ;
382380 }
383381
384382 [ Test , STAThreadExecutor ]
@@ -393,8 +391,8 @@ public async Task WhenOnlySingleDialogHostIdentifierIsNullItShowsDialog()
393391 {
394392 dialogHost2 . RaiseEvent ( new RoutedEventArgs ( FrameworkElement . LoadedEvent ) ) ;
395393 Task showTask = DialogHost . Show ( "Content" ) ;
396- Assert . True ( DialogHost . IsDialogOpen ( null ) ) ;
397- Assert . False ( DialogHost . IsDialogOpen ( dialogHost2 . Identifier ) ) ;
394+ await Assert . That ( DialogHost . IsDialogOpen ( null ) ) . IsTrue ( ) ;
395+ await Assert . That ( DialogHost . IsDialogOpen ( dialogHost2 . Identifier ) ) . IsFalse ( ) ;
398396 DialogHost . Close ( null ) ;
399397 await showTask ;
400398 }
@@ -405,8 +403,7 @@ public async Task WhenOnlySingleDialogHostIdentifierIsNullItShowsDialog()
405403 }
406404
407405 [ Test , STAThreadExecutor ]
408- [ Description ( "Issue 2844" ) ]
409- public void GetDialogSession_ShouldAllowAccessFromMultipleUIThreads ( )
406+ public async Task GetDialogSession_ShouldAllowAccessFromMultipleUIThreads ( )
410407 {
411408 DialogHost ? dialogHost = null ;
412409 DialogHost ? dialogHostOnOtherUiThread = null ;
0 commit comments