コード例 #1
0
        public async Task AddMagnetLink()
        {
            using (IDelugeRpc deluge = await daemon.OpenRpcAsync())
            {
                await deluge.LoginAsync(Resources.Username, Resources.Password);

                string torrentId = await deluge.AddMagnetAsync(Resources.MagnetLink1);

                await deluge.RemoveTorrentAsync(torrentId, true);

                Assert.IsNotNull(torrentId, "torrentId != null");
            }
        }
コード例 #2
0
        public async Task GetTorrentStatus()
        {
            using (IDelugeRpc deluge = await daemon.OpenRpcAsync())
            {
                await deluge.LoginAsync(Resources.Username, Resources.Password);

                string torrentId = await deluge.AddMagnetAsync(Resources.MagnetLink1);

                try
                {
                    IDictionary <string, object> status = await deluge.GetTorrentStatusAsync(torrentId, new [] { BuiltInStatuses.Name, BuiltInStatuses.ActiveTime });

                    Assert.IsNotNull(status, "status != null");
                    Assert.AreEqual(2, status.Count, "status.Count == 2");
                    Assert.IsTrue(status.ContainsKey(BuiltInStatuses.Name), "status.ContainsKey(BuiltInStatuses.Name)");
                    Assert.IsTrue(status.ContainsKey(BuiltInStatuses.ActiveTime), "status.ContainsKey(BuiltInStatuses.ActiveTime)");
                }
                finally
                {
                    await deluge.RemoveTorrentAsync(torrentId, true);
                }
            }
        }