Exemple #1
0
        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 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");
            }
        }