Пример #1
0
        public async Task AddNewTorrentTask()
        {
            var mockFactory = new Mock <IHttpClientFactory>();

            mockFactory.Setup(c => c.CreateClient()).Returns(new HttpClient());
            var downloader   = new Aria2Downloader(configuration, mockFactory.Object, new NullLogger <Aria2Downloader>());
            var torrentBytes = File.ReadAllBytes("valid.torrent");
            await downloader.AddNewTorrentTask(torrentBytes);
        }
Пример #2
0
        public async Task TryConnect()
        {
            var mockFactory = new Mock <IHttpClientFactory>();

            mockFactory.Setup(c => c.CreateClient()).Returns(new HttpClient());
            var downloader = new Aria2Downloader(configuration, mockFactory.Object, new NullLogger <Aria2Downloader>());
            var result     = await downloader.TryConnect();

            Assert.IsTrue(result);
        }