New: Async HttpClient

(cherry picked from commit 0feee191462dd3e5dde66e476e8b4b46a85ec4f0)
This commit is contained in:
Bogdan
2023-07-16 21:07:31 +03:00
parent 29118cda45
commit 1f95bcae4e
58 changed files with 680 additions and 555 deletions
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using FluentAssertions;
using Moq;
using NUnit.Framework;
@@ -55,26 +56,26 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
}
[Test]
public void Download_should_return_unique_id()
public async Task Download_should_return_unique_id()
{
GivenSuccessfulDownload();
var remoteBook = CreateRemoteBook();
var id = Subject.Download(remoteBook, CreateIndexer());
var id = await Subject.Download(remoteBook, CreateIndexer());
id.Should().NotBeNullOrEmpty();
}
[Test]
public void Download_with_TvDirectory_should_force_directory()
public async Task Download_with_TvDirectory_should_force_directory()
{
GivenTvDirectory();
GivenSuccessfulDownload();
var remoteBook = CreateRemoteBook();
var id = Subject.Download(remoteBook, CreateIndexer());
var id = await Subject.Download(remoteBook, CreateIndexer());
id.Should().NotBeNullOrEmpty();
@@ -83,14 +84,14 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
}
[Test]
public void Download_with_category_should_force_directory()
public async Task Download_with_category_should_force_directory()
{
GivenMusicCategory();
GivenSuccessfulDownload();
var remoteBook = CreateRemoteBook();
var id = Subject.Download(remoteBook, CreateIndexer());
var id = await Subject.Download(remoteBook, CreateIndexer());
id.Should().NotBeNullOrEmpty();
@@ -99,7 +100,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
}
[Test]
public void Download_with_category_should_not_have_double_slashes()
public async Task Download_with_category_should_not_have_double_slashes()
{
GivenMusicCategory();
GivenSuccessfulDownload();
@@ -108,7 +109,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
var remoteBook = CreateRemoteBook();
var id = Subject.Download(remoteBook, CreateIndexer());
var id = await Subject.Download(remoteBook, CreateIndexer());
id.Should().NotBeNullOrEmpty();
@@ -117,13 +118,13 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
}
[Test]
public void Download_without_TvDirectory_and_Category_should_use_default()
public async Task Download_without_TvDirectory_and_Category_should_use_default()
{
GivenSuccessfulDownload();
var remoteBook = CreateRemoteBook();
var id = Subject.Download(remoteBook, CreateIndexer());
var id = await Subject.Download(remoteBook, CreateIndexer());
id.Should().NotBeNullOrEmpty();
@@ -132,14 +133,14 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
}
[TestCase("magnet:?xt=urn:btih:ZPBPA2P6ROZPKRHK44D5OW6NHXU5Z6KR&tr=udp", "CBC2F069FE8BB2F544EAE707D75BCD3DE9DCF951")]
public void Download_should_get_hash_from_magnet_url(string magnetUrl, string expectedHash)
public async Task Download_should_get_hash_from_magnet_url(string magnetUrl, string expectedHash)
{
GivenSuccessfulDownload();
var remoteBook = CreateRemoteBook();
remoteBook.Release.DownloadUrl = magnetUrl;
var id = Subject.Download(remoteBook, CreateIndexer());
var id = await Subject.Download(remoteBook, CreateIndexer());
id.Should().Be(expectedHash);
}