Skip to content

Commit 462586f

Browse files
committed
Fix Chapter download issue with
Update DownloadAssistant package Update Unit Test
1 parent 87d7938 commit 462586f

File tree

17 files changed

+35
-35
lines changed

17 files changed

+35
-35
lines changed

UnitTest/DownloadTest.cs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

UnitTest/UnitTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<ProjectReference Include="..\WebsiteScrapper\WebsiteScraper.csproj" />
20+
<ProjectReference Include="..\WebsiteScraper\WebsiteScraper.csproj" />
2121
</ItemGroup>
2222

2323
</Project>

WebsiteScraper.sln

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.4.33122.133
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebsiteScraper", "WebsiteScrapper\WebsiteScraper.csproj", "{78A9A02C-98AD-4737-A814-5BF849FA412A}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest", "UnitTest\UnitTest.csproj", "{BA6968D1-CD38-4AAC-9E7A-7830D180DAB3}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest", "UnitTest\UnitTest.csproj", "{BA6968D1-CD38-4AAC-9E7A-7830D180DAB3}"
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebsiteScraper", "WebsiteScraper\WebsiteScraper.csproj", "{059340C7-558E-4AC3-AE88-6AF78231903B}"
99
EndProject
1010
Global
1111
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1212
Debug|Any CPU = Debug|Any CPU
1313
Release|Any CPU = Release|Any CPU
1414
EndGlobalSection
1515
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16-
{78A9A02C-98AD-4737-A814-5BF849FA412A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17-
{78A9A02C-98AD-4737-A814-5BF849FA412A}.Debug|Any CPU.Build.0 = Debug|Any CPU
18-
{78A9A02C-98AD-4737-A814-5BF849FA412A}.Release|Any CPU.ActiveCfg = Release|Any CPU
19-
{78A9A02C-98AD-4737-A814-5BF849FA412A}.Release|Any CPU.Build.0 = Release|Any CPU
2016
{BA6968D1-CD38-4AAC-9E7A-7830D180DAB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2117
{BA6968D1-CD38-4AAC-9E7A-7830D180DAB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
2218
{BA6968D1-CD38-4AAC-9E7A-7830D180DAB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
2319
{BA6968D1-CD38-4AAC-9E7A-7830D180DAB3}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{059340C7-558E-4AC3-AE88-6AF78231903B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{059340C7-558E-4AC3-AE88-6AF78231903B}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{059340C7-558E-4AC3-AE88-6AF78231903B}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{059340C7-558E-4AC3-AE88-6AF78231903B}.Release|Any CPU.Build.0 = Release|Any CPU
2424
EndGlobalSection
2525
GlobalSection(SolutionProperties) = preSolution
2626
HideSolutionNode = FALSE
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)