@@ -8,48 +8,48 @@ namespace UnitTest
88 [ TestClass ]
99 public class DownloadTest
1010 {
11+ private const string _pathToWebsite = @"D:\Bibliothek\Visual Studio\Librarys\WebsiteScraper\mangaread.org.wsf" ;
12+
13+ private Website _mangaread = null ! ;
14+
15+ [ TestInitialize ]
16+ public void Initialize ( )
17+ {
18+ _mangaread = Website . LoadWebsite ( _pathToWebsite ) ;
19+ }
20+
1121 [ TestMethod ]
12- public async Task Search ( )
22+ public async Task SearchAsync ( )
1323 {
14- Website mangaread = Website . LoadWebsite ( @"C:\Bibliothek\Visual Studio\WebsiteScraper\mangaread.org.wsf" ) ;
15- mangaread . ItemsPerSearch = 20 ;
16- await mangaread . GetStatusTask ( ) ;
17- Comic [ ] searchComics = await mangaread . SearchAsync < Comic > ( "isekai" ) ;
24+ _mangaread . ItemsPerSearch = 20 ;
25+ await _mangaread . GetStatusTask ( ) ;
26+ Comic [ ] searchComics = await _mangaread . SearchAsync < Comic > ( "isekai" ) ;
1827 Console . WriteLine ( "Comics found: " + searchComics . Length ) ;
1928 for ( int i = 0 ; i < searchComics . Length ; i ++ )
20- {
2129 Console . WriteLine ( $ "{ i } | { searchComics [ i ] . Title } ") ;
22- }
2330 }
2431
2532 [ TestMethod ]
26- public async Task Update ( )
33+ public async Task UpdateTestAsync ( )
2734 {
28- Website mangaread = Website . LoadWebsite ( @"C:\Bibliothek\Visual Studio\WebsiteScraper\mangaread.org.wsf" ) ;
29- Comic onePunch = new ( "https://www.mangaread.org/manga/one-punch-man-onepunchman/" , "One Punch Man" , mangaread ) ;
35+ await _mangaread . GetStatusTask ( ) ;
36+ Comic onePunch = new ( "https://www.mangaread.org/manga/one-punch-man-onepunchman/" , "One Punch Man" , _mangaread ) ;
3037 await onePunch . UpdateAsync ( ) ;
3138 Console . WriteLine ( onePunch . Title ) ;
3239 Console . WriteLine ( onePunch . Chapter . Length + " Chapters" ) ;
3340 Console . WriteLine ( "Description: " + onePunch . Description ) ;
3441 }
3542
3643 [ TestMethod ]
37- public async Task Download ( )
44+ public async Task DownloadTestAsync ( )
3845 {
39- Website mangaread = Website . LoadWebsite ( @"C:\Bibliothek\Visual Studio\WebsiteScraper\mangaread.org.wsf" ) ;
40- await mangaread . GetStatusTask ( ) ;
41- Comic onePunch = new ( "https://www.mangaread.org/manga/one-punch-man-onepunchman/" , "One Punch Man" , mangaread ) ;
46+ await _mangaread . GetStatusTask ( ) ;
47+ Comic onePunch = new ( "https://www.mangaread.org/manga/one-punch-man-onepunchman/" , "One Punch Man" , _mangaread ) ;
4248 await onePunch . UpdateAsync ( ) ;
43- ProgressableContainer < LoadRequest > ? container = await onePunch . Chapter . First ( ) . DownloadAsync ( @"C:\Bibliothek\Download\One Punch Man\1\" ) ;
44- container . StateChanged += Container_StateChanged ;
45- if ( container != null )
46- await container . Task ;
47- else throw new ArgumentNullException ( ) ;
48- }
49-
50- private void Container_StateChanged ( object ? sender , Requests . Options . RequestState e )
51- {
52- Console . WriteLine ( e ) ;
49+ ProgressableContainer < LoadRequest > container = await onePunch . Chapter . First ( ) . DownloadAsync ( @"D:\Bibliothek\Downloads\One Punch Man\1\" ) ;
50+ container . StateChanged += ( s , e ) => Console . WriteLine ( "State: " + e ) ;
51+ await container . Task ;
52+ Console . WriteLine ( "Downloaded" ) ;
5353 }
5454 }
5555}
0 commit comments