-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DelugeClientConfig to set timeout and other future stuff (#5)
* Added docker-compose.yml to help testing * Added DelugeClientConfig class to store timeout and other future stuff * Set defaut timeout to 3 seconds * Update README.md
- Loading branch information
Showing
10 changed files
with
179 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -348,3 +348,4 @@ MigrationBackup/ | |
|
||
# Ionide (cross platform F# VS Code tools) working folder | ||
.ionide/ | ||
docker/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using DelugeRPCClient.Net.Models; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Reflection; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace DelugeRPCClient.Net.Tests | ||
{ | ||
public class DelugeClientTest | ||
{ | ||
protected async Task<DelugeClient> Login() | ||
{ | ||
DelugeClientConfig config = new DelugeClientConfig() | ||
{ | ||
IgnoreSslErrors = true, | ||
Timeout = new TimeSpan(0, 0, 30) | ||
}; | ||
DelugeClient client = new DelugeClient(url: Constants.DelugeUrl, password: Constants.DelugePassword, config); | ||
bool loginResult = await client.Login(); | ||
Assert.IsTrue(loginResult); | ||
|
||
return client; | ||
} | ||
|
||
protected async Task Logout(DelugeClient client) | ||
{ | ||
bool logoutResult = await client.Logout(); | ||
Assert.IsTrue(logoutResult); | ||
} | ||
|
||
protected async Task<Torrent> AddTestTorrent(DelugeClient client) | ||
{ | ||
Torrent torrent = await client.AddTorrentByFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), Constants.TestTorrentFilename)); | ||
Assert.IsNotNull(torrent); | ||
Thread.Sleep(1000); | ||
return torrent; | ||
} | ||
|
||
protected async Task RemoveTestTorrent(DelugeClient client, Torrent torrent) | ||
{ | ||
bool removeTorrentResult = await client.RemoveTorrent(torrent.Hash); | ||
Assert.IsTrue(removeTorrentResult); | ||
Thread.Sleep(1000); | ||
} | ||
|
||
protected async Task AddTestLabel(DelugeClient client) | ||
{ | ||
bool addLabelResult = await client.AddLabel(Constants.TestLabelName); | ||
Assert.IsTrue(addLabelResult); | ||
Thread.Sleep(1000); | ||
} | ||
|
||
protected async Task RemoveTestLabel(DelugeClient client) | ||
{ | ||
bool removeLabelResult = await client.RemoveLabel(Constants.TestLabelName); | ||
Assert.IsTrue(removeLabelResult); | ||
Thread.Sleep(1000); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.