@@ -141,10 +141,12 @@ public async Task I_can_try_to_get_the_list_of_available_streams_of_a_video_and_
141141 // Arrange
142142 using var youtube = new YoutubeClient ( ) ;
143143
144- // Act & assert
145- var ex = await Assert . ThrowsAsync < VideoRequiresPurchaseException > ( async ( ) =>
146- await youtube . Videos . Streams . GetManifestAsync ( VideoIds . RequiresPurchase )
147- ) ;
144+ // Act
145+ var act = async ( ) =>
146+ await youtube . Videos . Streams . GetManifestAsync ( VideoIds . RequiresPurchase ) ;
147+
148+ // Assert
149+ var ex = ( await act . Should ( ) . ThrowAsync < VideoRequiresPurchaseException > ( ) ) . Which ;
148150
149151 ex . PreviewVideoId . Value . Should ( ) . NotBeNullOrWhiteSpace ( ) ;
150152
@@ -157,10 +159,11 @@ public async Task I_can_try_to_get_the_list_of_available_streams_of_a_video_and_
157159 // Arrange
158160 using var youtube = new YoutubeClient ( ) ;
159161
160- // Act & assert
161- var ex = await Assert . ThrowsAsync < VideoUnavailableException > ( async ( ) =>
162- await youtube . Videos . Streams . GetManifestAsync ( VideoIds . Private )
163- ) ;
162+ // Act
163+ var act = async ( ) => await youtube . Videos . Streams . GetManifestAsync ( VideoIds . Private ) ;
164+
165+ // Assert
166+ var ex = ( await act . Should ( ) . ThrowAsync < VideoUnavailableException > ( ) ) . Which ;
164167
165168 testOutput . WriteLine ( ex . ToString ( ) ) ;
166169 }
@@ -171,10 +174,11 @@ public async Task I_can_try_to_get_the_list_of_available_streams_of_a_video_and_
171174 // Arrange
172175 using var youtube = new YoutubeClient ( ) ;
173176
174- // Act & assert
175- var ex = await Assert . ThrowsAsync < VideoUnavailableException > ( async ( ) =>
176- await youtube . Videos . Streams . GetManifestAsync ( VideoIds . Deleted )
177- ) ;
177+ // Act
178+ var act = async ( ) => await youtube . Videos . Streams . GetManifestAsync ( VideoIds . Deleted ) ;
179+
180+ // Assert
181+ var ex = ( await act . Should ( ) . ThrowAsync < VideoUnavailableException > ( ) ) . Which ;
178182
179183 testOutput . WriteLine ( ex . ToString ( ) ) ;
180184 }
@@ -308,10 +312,12 @@ public async Task I_can_try_to_get_the_HTTP_live_stream_URL_for_a_video_and_get_
308312 // Arrange
309313 using var youtube = new YoutubeClient ( ) ;
310314
311- // Act & assert
312- var ex = await Assert . ThrowsAsync < VideoUnplayableException > ( async ( ) =>
313- await youtube . Videos . Streams . GetHttpLiveStreamUrlAsync ( VideoIds . RequiresPurchase )
314- ) ;
315+ // Act
316+ var act = async ( ) =>
317+ await youtube . Videos . Streams . GetHttpLiveStreamUrlAsync ( VideoIds . RequiresPurchase ) ;
318+
319+ // Assert
320+ var ex = ( await act . Should ( ) . ThrowAsync < VideoUnplayableException > ( ) ) . Which ;
315321
316322 testOutput . WriteLine ( ex . ToString ( ) ) ;
317323 }
@@ -322,10 +328,12 @@ public async Task I_can_try_to_get_the_HTTP_live_stream_URL_for_a_video_and_get_
322328 // Arrange
323329 using var youtube = new YoutubeClient ( ) ;
324330
325- // Act & assert
326- var ex = await Assert . ThrowsAsync < YoutubeExplodeException > ( async ( ) =>
327- await youtube . Videos . Streams . GetHttpLiveStreamUrlAsync ( VideoIds . Normal )
328- ) ;
331+ // Act
332+ var act = async ( ) =>
333+ await youtube . Videos . Streams . GetHttpLiveStreamUrlAsync ( VideoIds . Normal ) ;
334+
335+ // Assert
336+ var ex = ( await act . Should ( ) . ThrowAsync < YoutubeExplodeException > ( ) ) . Which ;
329337
330338 testOutput . WriteLine ( ex . ToString ( ) ) ;
331339 }
0 commit comments