public void TestConsolidateTorrentWithNoTorrentInResponseResult() { BaseResponse response = new Response(); response.Result = new Result(null); Assert.IsNull(UTorrentClient.ConsolidateTorrent(response, string.Empty)); }
public void TestGetTorrentWithFiles() { try { UTorrentClient client = new UTorrentClient("admin", "password"); var response = client.GetList(); Assert.IsNull(response.Error); Assert.IsNotNull(response.Result); Assert.IsNotNull(response.Result.Torrents); Assert.AreNotEqual(response.Result.Torrents.Count, 0); var torrent = response.Result.Torrents[0]; response = client.GetTorrent(torrent.Hash.ToLower()); Assert.IsNull(response.Error); Assert.IsNotNull(response.Result); torrent = UTorrentClient.ConsolidateTorrent(response, torrent.Hash); Assert.IsNotNull(torrent); Assert.IsNotNull(torrent.Files); Assert.AreNotEqual(torrent.Files.Count, 0); } catch (ServerUnavailableException) { Assert.Inconclusive("Serveur unavailable"); } catch (InvalidCredentialException) { Assert.Inconclusive("Invalid credential"); } }
public void TestConsolidateTorrentWithNullHashParameter() { BaseResponse response = new Response(); response.Result = new Result(null); UTorrentClient.ConsolidateTorrent(response, null); }
public void TestConsolidateTorrentWithNullResponseResultParameter() { BaseResponse response = new Response(); response.Result = null; UTorrentClient.ConsolidateTorrent(response, string.Empty); }
public void TestConsolidateTorrentWithNullResponseResultParameter() { BaseResponse response = new Response(); response.Result = null; Assert.ThrowsException <ArgumentNullException>(() => UTorrentClient.ConsolidateTorrent(response, string.Empty)); }
public void TestConsolidateTorrentWithNullHashParameter() { BaseResponse response = new Response(); response.Result = new Result(null); Assert.ThrowsException <ArgumentNullException>(() => UTorrentClient.ConsolidateTorrent(response, null)); }
public void TestGetTorrentWithFilesAsync() { UTorrentClient client = new UTorrentClient("admin", "password"); Task <Response> task = client.GetListAsync(); try { task.Wait(); } catch (AggregateException ex) { if (ex.InnerExceptions.Count == 1 && ex.InnerExceptions[0].GetType() == typeof(ServerUnavailableException)) { Assert.Inconclusive("Serveur unavailable"); } if (ex.InnerExceptions.Count == 1 && ex.InnerExceptions[0].GetType() == typeof(InvalidCredentialException)) { Assert.Inconclusive("Invalid credential"); } } var response = task.Result; Assert.IsNull(response.Error); Assert.IsNotNull(response.Result); Assert.IsNotNull(response.Result.Torrents); Assert.AreNotEqual(response.Result.Torrents.Count, 0); var torrent = response.Result.Torrents[0]; task = client.GetTorrentAsync(torrent.Hash.ToLower()); try { task.Wait(); } catch (AggregateException ex) { if (ex.InnerExceptions.Count == 1 && ex.InnerExceptions[0].GetType() == typeof(ServerUnavailableException)) { Assert.Inconclusive("Serveur unavailable"); } if (ex.InnerExceptions.Count == 1 && ex.InnerExceptions[0].GetType() == typeof(InvalidCredentialException)) { Assert.Inconclusive("Invalid credential"); } } response = task.Result; Assert.IsNull(response.Error); Assert.IsNotNull(response.Result); torrent = UTorrentClient.ConsolidateTorrent(response, torrent.Hash); Assert.IsNotNull(torrent); Assert.IsNotNull(torrent.Files); Assert.AreNotEqual(torrent.Files.Count, 0); }
public void TestConsolidateTorrentWithNullResponseParameter() { UTorrentClient.ConsolidateTorrent(null, string.Empty); }
public void TestConsolidateTorrentWithNullResponseParameter() { Assert.ThrowsException <ArgumentNullException>(() => UTorrentClient.ConsolidateTorrent(null, string.Empty)); }